This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Global change of an attribute name
I am using XSLT to change XML in one DTD to XML in a slightly modified
DTD. In the original DTD, the attribute R can appear on virtually any
element; I would prefer that the attribute be called REND. Is there a way
to change this globally anywhere it appears (<xsl:template match="@R">, I
presume), or does it have to be adressed on an element by element level?
<xsl:template match="@R">
<xsl:attribute name="REND">
<xsl:value-of select="."/>
</xsl:attribute>
<xsl:template match="@*">
<xsl:copy-of select="."/>
</xsl:attribute>
will copy all attributes, except for renaming R to REND
but as attribute nodes are not on the default selection for
apply-templates you'll need to make sure that every template that is
making an element node calls
<xsl:apply-templates select="@*"/>
David
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list