This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
using <xsl:variable>
- To: XSL-List at mulberrytech dot com
- Subject: using <xsl:variable>
- From: "Dhruv Raheja" <dhruv_r at hotmail dot com>
- Date: Tue, 26 Sep 2000 10:17:49 EDT
- Reply-To: xsl-list at mulberrytech dot com
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