[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] xsl:variable


Subject: RE: [xsl] xsl:variable
From: "Craig Kattner" <CKattner@xxxxxxxxxxxxxx>
Date: Thu, 6 Mar 2003 10:59:34 -0600

I think this'll work, I've done something similar:

<xsl:template match="category">
	<xsl:variable name="iteration">
		<xsl:number />
	</xsl:variable>
	<xsl:value-of select="iteration" />
</xsl:template>

number will be incremented every time that template executed (at least it works with MSXML 4).


-----Original Message-----
From: Laurence Mossuz [mailto:mossuz@xxxxxxxxxxxxx]
Sent: Thursday, March 06, 2003 10:27 AM
To: XSL-forms xslforms
Subject: [xsl] xsl:variable


hello

i would like to declare a variable counter in my xsl file and to
incremente it whenever i have the occurence toto in my XML file.
toto is a complextype whose maxOccurs="unbounded" in the schema
declaration.
For instance we can have in the xml file :
<test>
    <toto>
      <titi/>
      <tata/>
    </toto>
    <toto>
     <titi>hello</titi>
      <tata>bye</tata>
    </toto>
</test>

i would like to write something like this :

<xsl:variable name="counter" select="0"/>
<xsl:for-each select="toto">
    <xsl:variable name="counter" select="$counter+1"/>
</xsl:for-each>

i know that i'm wrong but how could i do that?

Many thanks for your help!!

Lo.
--

Laurence MOSSUZ

LAPP Service Informatique
Chemin de Bellevue BP 110
74941 Annecy-Le-Vieux CEDEX
Tel : 04 50 09 17 31 _ Fax : 04 50 27 94 95



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


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



Current Thread
Keywords