using <xsl:variable>

Subject: using <xsl:variable>
From: "Dhruv Raheja" <dhruv_r@xxxxxxxxxxx>
Date: Tue, 26 Sep 2000 10:17:49 EDT
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"/>

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,

Get Your Private, Free E-mail from MSN Hotmail at

Share information about yourself, create your own public profile at

XSL-List info and archive:

Current Thread