I\'m trying to transform this xml:
nomX
prenomX
-
I used your answer to find the right xsl:
here is what i use:
<xsl:template match="token">
<xsl:element name="{@cle}">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
Thank a lot !
讨论(0)
-
This should do the trick:
<xsl:template match="token">
<xsl:element name="{@cle}">
<xsl:apply-templates select="*|@*"/>
</xsl:element>
</xsl:template>
for more info on xsl:element see:
http://www.w3.org/TR/xslt#section-Creating-Elements-with-xsl:element
you might want to add some xsl:if to check if there really is a @cle attribute, but otherwise this should work fine
讨论(0)
-
so xslt is the right way I think:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8"
indent="yes" />
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>
<xsl:template match="token">
<xsl:element name="{@cle}">
<xsl:apply-templates />
</xsl:element>
</xsl:template>
</xsl:stylesheet>
讨论(0)
- 热议问题