[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Hitting the same node with two templates?

Subject: Hitting the same node with two templates?
From: Richard Rowell <richard@xxxxxxxxxxxxxxxxx>
Date: 25 Sep 2002 17:01:08 -0500
richard rowell
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.