Re: [xsl] While copying everything, append attribute value with incremental index.

Subject: Re: [xsl] While copying everything, append attribute value with incremental index.
From: Xuan Ngo <xuanngo2001@xxxxxxxxx>
Date: Sat, 11 Aug 2007 12:49:16 -0700 (PDT)
Thank you Dimitre Novatchev for your explanation of the position().

However, can you explain the logic of the code that you provided:
 <xsl:template match="A[@i]">
   <xsl:variable name="vInum">
     <xsl:number count="A[@i]"/>
   </xsl:variable>
   <A i="{concat(@i,'_',$vInum)}">
	  <xsl:apply-templates select=
	    "@*[not(name()='i')]
	    |
	     node()
	    "
	  />
    </A>
 </xsl:template>
--------------------------
I will take a shot here. Tell me if I am right. Each time that it encounters the condition
"A[@i]", it will sum up all preceding "A[@i]". Hence, creating an incremental index(1,2,3,...). 
Then, it assigns the sum to the variable vInum so that later it can be used to create the element
A. Since the code is creating the attribute i then it shouldn't copy it. Hence, the condition
"[not(name()='i')]"

thx!


       
____________________________________________________________________________________
Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow  

Current Thread