[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Hitting the same node with two templates?
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|