This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: XSL : how to turn <name> into <data elem="name">
- To: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] XSL : how to turn <name> into <data elem="name">
- From: Ben Robb <b dot robb at cscape dot com>
- Date: Thu, 8 Feb 2001 00:14:46 -0000
- Reply-To: xsl-list at lists dot mulberrytech dot com
<xsl:template match="*">
<xsl:choose>
<xsl:if test="name() = 'name'">
<data elem="name"><xsl:value-of select="."/></data>
</xsl:if>
<xsl:otherwise>
<xsl:copy>
<xsl:for-each select="@*">
<xsl:attribute
name="{name()}"><xsl:value-of select="."/></xsl:attribute>
</xsl:for-each>
<xsl:apply-templates/>
</xsl:copy>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
There is probably are more elegant way of doing it, but this should work,
and its too late to think about it harder *grin*
Ben
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list