Subject: [xsl] Adding attributes to all ancestors of a given node (was RE: [xsl] XSL and javascript) From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Wed, 12 Mar 2003 14:11:33 -0500 |
I am trying to simply duplicate an XML tree with the addition of adding an attribute to all the ancestors of a given element.
<xsl:template match="node()|@*"> <xsl:copy> <xsl:if test="descendant::*[@task='1']"> <xsl:attribute name="task"> <!-- your attribute's value goes here --> </xsl:attribute> </xsl:if> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template>
Cheers, Wendell
___&&__&_&___&_&__&&&__&_&__&__&&____&&_&___&__&_&&_____&__&__&&_____&_&&_ "Thus I make my own use of the telegraph, without consulting the directors, like the sparrows, which I perceive use it extensively for a perch." -- Thoreau
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] XSL and javascript, Mac Martine | Thread | [xsl] getting the longest text node, florian |
Re: [xsl] disable-output-escaping=", Mike Brown | Date | Re: [xsl] cdata(), Mike Brown |
Month |