Subject: Re: Copying node but changing attributes From: David Carlisle <davidc@xxxxxxxxx> Date: Fri, 29 Sep 2000 16:35:46 GMT |
well, you've done 99% of the work, the only thing to do is fill in <!-- DO SOMETHING WITH ATTR --> (and take out xsl:copy) but hard to say as you haven't said how you want to change the attribute. For example <xsl:template match="node"> <xsl:copy> <xsl:copy-of"@*[not(name()='x' or name()='y')]"> <xsl:attribute name="xxx"> <xsl:value-of select="@y"/> </xsl:attribute> <xsl:attribute name="yyy"> I was here </xsl:attribute> <xsl:apply-templates/> </xsl:copy> </xsl:template> copies any attribute not called x or y, makes a new attribute xxx with the data from the old y attribute, makes a new attribute yyy and doesn't use the old x attribute at all. or perhaps <xsl:template match="node"> <xsl:copy> <xsl:for-each select="@*"> <xsl:attribute name="new-{name()}"> <xsl:text>modified from </xsl:text> <xsl:value-of select="."/> </xsl:attribute> </xsl:for-each> <xsl:apply-templates/> </xsl:copy> </xsl:template> which changes <node a="1" b="2"> to <node new-a="modified from 1" new-b="modified from 2"> or at least I hope it does, haven't checked:-) David XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Copying node but changing attribute, Joerg Colberg | Thread | RE: Copying node but changing attri, Kay Michael |
"Breaking Out" of an xsl transforma, tshenton | Date | RE: "Breaking Out" of an xsl transf, sara . mitchell |
Month |