Subject: RE: xsl templates, Removing spurious namespace declarations in output elements
From: "Tim Wilkins" <Tim.Wilkins@xxxxxxxxxxxxxxxx>
Date: Wed, 9 Apr 2003 13:55:45 +0100
|
I have a solution which seems to work for a simple copy:
<xsl:template name="recurseCopy">
<xsl:choose>
<xsl:when test="local-name()=''">
<xsl:copy/>
</xsl:when>
<xsl:otherwise>
<xsl:element name="{local-name()}" namespace="">
<xsl:for-each select="@*">
<xsl:attribute name="{local-name()}">
<xsl:value-of select="current()"/>
</xsl:attribute>
</xsl:for-each>
<xsl:for-each select="node()">
<xsl:call-template name="recurseCopy"/>
</xsl:for-each>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="Point|Attribute">
<xsl:call-template name="recurseCopy"/>
</xsl:template>
but if anyone can see any simplifications or problems with this, that would
be useful! The <xsl:when> bit is needed for copying text nodes.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|
Michael Kay - Wed, 9 Apr 2003 15:38:18 -0400 (EDT)
|
|