This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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


<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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]