xsl-list
[Top] [All Lists]

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

2007-08-11 12:49:40
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[(_at_)i]">
   <xsl:variable name="vInum">
     <xsl:number count="A[(_at_)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[(_at_)i]", it will sum up all preceding "A[(_at_)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  

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--