[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
RE: [xsl] context-independent counter
Subject: RE: [xsl] context-independent counter From: Ben Robb <b.robb@xxxxxxxxxx> Date: Wed, 7 Feb 2001 15:23:05 -0000 |
If you just want a counter, try something like this: <xsl:template match="/"> <xsl:call-template name="counter"> <xsl:with-param name="i">1</xsl:with-param> </xsl:call-template> </xsl:template> <xsl:template name="counter"> <xsl:param name="i"/> <!-- do something --> <xsl:if test="not($i > 10)"> <xsl:call-template name="counter"> <xsl:with-param name="i"><xsl:value-of select="$i + 1"/></xsl:with-param> </xsl:call-template> </xsl:if> </xsl:template> Basically, you are recursively calling a named template with a parameter; i.e. you can do a "for i = 1 to x" loop. Hopefully this should be enough to get you going... Ben XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] context-independent count, Michael Kay | Thread | RE: [xsl] context-independent count, Tobias Reif |
[xsl] Passing parameters to jakarta, Peter McEvoy | Date | RE: [xsl] context-independent count, Tobias Reif |
Month |