1.1 --- a/XSLForms/XSL/FixNamespace.xsl Sat Nov 11 01:43:16 2006 +0000
1.2 +++ b/XSLForms/XSL/FixNamespace.xsl Sat Nov 11 01:43:26 2006 +0000
1.3 @@ -28,6 +28,10 @@
1.4 doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
1.5 doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
1.6
1.7 + <!-- Get all declared expr-prefix attributes. -->
1.8 +
1.9 + <xsl:variable name="prefixes" select="//@expr-prefix"/>
1.10 +
1.11
1.12
1.13 <!-- Process the root element. -->
1.14 @@ -36,7 +40,7 @@
1.15 <xsl:for-each select="*">
1.16 <!-- NOTE: Not stating the namespace explicitly. -->
1.17 <xsl:element name="{name()}">
1.18 - <xsl:for-each select="//@expr-prefix">
1.19 + <xsl:for-each select="$prefixes">
1.20 <xsl:attribute namespace="{substring-after(string(), ' ')}" name="{substring-before(string(), ' ')}:{name()}"><xsl:value-of select="string()"/></xsl:attribute>
1.21 </xsl:for-each>
1.22 <xsl:apply-templates select="@*|node()"/>
1.23 @@ -85,9 +89,12 @@
1.24 <!-- Traverse unknown nodes. -->
1.25
1.26 <xsl:template match="@*|node()">
1.27 - <xsl:copy>
1.28 - <xsl:apply-templates select="@*|node()"/>
1.29 - </xsl:copy>
1.30 + <xsl:variable name="this-name" select="name()"/>
1.31 + <xsl:if test="not($prefixes[substring-before(string(), ' ') = $this-name])">
1.32 + <xsl:copy>
1.33 + <xsl:apply-templates select="@*|node()"/>
1.34 + </xsl:copy>
1.35 + </xsl:if>
1.36 </xsl:template>
1.37
1.38 </xsl:stylesheet>