[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: context-independent counter

Subject: RE: context-independent counter
From: Ben Robb <b.robb@xxxxxxxxxx>
Date: Wed, 7 Feb 2001 15:23:05 -0000
RE:  context-independent counter
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.