Subject: [xsl] Hitting the same node with two templates? From: Richard Rowell <richard@xxxxxxxxxxxxxxxxx> Date: 25 Sep 2002 17:01:08 -0500 |
Probably a newbie question, but I can't seem to find the answer in my book. I want to process the same node twice, adding a different attribute each time. I only want the node output once however. I'm trying the snippit below but the first template seems to be ignored. I'm sure there is a good explanation, and I would be ecstatic if someone could share it with me. <!-- adds in the odbid attribute for service items (just copies the one from the client (grandparent) --> <xsl:template match="client/service_items/service_item"> <xsl:copy> <xsl:attribute name="odbid"> <xsl:value-of select="../../@odbid"/> </xsl:attribute> <xsl:copy-of select="@*"/> <xsl:apply-templates select="node()"/> </xsl:copy> </xsl:template> <!-- give each grandchild that has children a record_id --> <xsl:template match="client/*/*[*]"> <xsl:copy> <xsl:choose> <xsl:when test="@record_id"/> <xsl:otherwise> <xsl:attribute name="record_id"> <xsl:value-of select="concat('client(' , ../../@record_id, ')-',name(), '-', position())"/> </xsl:attribute> </xsl:otherwise> </xsl:choose> <xsl:copy-of select="@*"/> <xsl:apply-templates select="node()"/> </xsl:copy> </xsl:template> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: Re[2]: [xsl] binary-or, McNally, David | Thread | Re: [xsl] Hitting the same node wit, David Carlisle |
RE: [xsl] binary-or, McNally, David | Date | [xsl] How do I process a result-tre, Greg Bender |
Month |