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

RE: increment value

Subject: RE: increment value
From: Strolia-Davis Christopher Contr MSG/MAT <Christopher.Strolia-Davis@xxxxxxxxxxxx>
Date: Thu, 22 Jan 2004 15:11:54 -0500
xsl increment
Anoop Govil said:
> Do you
> have a generic example of a recursive template? That will be 
> helpful to me
> and the original author of this post. 

unfortunately, I don't know if I can come up with one that will help
you that quickly.  I'm pretty familiar with the concepts of XSL,
but I have little actual experience implementing many of those concepts,
so I'm still a bit slow at the moment.

In my current look at your dilemma, I don't think the recursive
call would be pretty by any stretch of the imagination, and I don't
currently have the time to put it all together.

Here is a basic example of an incrementing recursive template.
(untested)

	<xsl:call-template name="recurse-to-10">
		<xsl:with-param name="current-inc">1</xsl:with-param>
	</xsl:call-template>

	<xsl:template name="recurse-to-10">
		<xsl:param name="current-inc"/>
		<xsl:value-of select="$current-inc"/>
		<xsl:if test="$current-inc&lt;10">
			<xsl:call-template name="recurse-to-10">
				<xsl:with-param name="current-inc" select="$current-inc"/>
			</xsl:call-template>
		</xsl:if>
	</xsl:template>

It iterates from the first number given (in this case 1) to 10
and prints out each number as it goes.

In your situation, you will probably have to pass a node in
the parameter in order to keep track.

hope this helps give you some ideas.


Chris Strolia-Davis
Database Specialist
Contractor - CDO Technologies Inc.



> -----Original Message-----
> From: Govil, Anoop (Contractor) [mailto:Anoop.Govil@xxxxxxxxxxxxxxxx]
> Sent: Thursday, January 22, 2004 1:15 PM
> To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
> Subject: RE:  increment value
> 
> 
> Hello Chris,
> 
> I have similar problem and have tried to implement recursive 
> template but
> when I used call-template, I am always at the root node. How 
> do you traverse
> the node. I wished there was a next() function just like 
> there is last().
> How do you go to next node with each recursive call to the 
> template? Do you
> have a generic example of a recursive template? That will be 
> helpful to me
> and the original author of this post. Thanks.
> 
> Anoop
> 

 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.