This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

using <xsl:variable>


Hello,
      I have a variable whose value I need to increment by 1 every time the 
template is called. i.e. I have an element called <figure> in which I have 
defined a variable called "fig". I need to increment the value of fig every 
time <figure> is called. I initially used the following instructions:

<xsl:template match="figure">
<xsl:variable name="fig" select="($fig+1)"/>
<xsl:value-of select="$fig"/>
------
</xsl:template>

However when I saw the output, all the fig values were displayed as 1. I 
realized that since fig was a local variable, it was being initialized each 
time the <figure> template was being called. I need to find a way to 
"remember" the previous value of fig each time <figure> is called, something 
similar to "$fig=$fig + 1".  Is it possible to write such an expression? 
Hope someone can help.

Thanks a lot,
Dhruv

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at 
http://profiles.msn.com.


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]