RE: [xsl] XSL : how to turn <name> into <data elem="name">

Subject: RE: [xsl] XSL : how to turn <name> into <data elem="name">
From: Ben Robb <b.robb@xxxxxxxxxx>
Date: Thu, 8 Feb 2001 00:14:46 -0000
<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


Current Thread