xsl-list
[Top] [All Lists]

RE: increment value

2004-01-22 13:11:54

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(_dot_)Govil(_at_)usmint(_dot_)treas(_dot_)gov]
Sent: Thursday, January 22, 2004 1:15 PM
To: 'xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com'
Subject: RE: [xsl] 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



<Prev in Thread] Current Thread [Next in Thread>