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

Re: round-robin template call

Subject: Re: round-robin template call
From: Mukul Gandhi <gandhi.mukul@xxxxxxxxx>
Date: Sun, 5 Apr 2009 23:06:49 +0530
Re:  round-robin template call
On Sun, Apr 5, 2009 at 10:17 PM, Aragon Gouveia <aragon@xxxxxxxxxxx> wrote:
> B  B  B  B <output>
> B  B  B  B  B  B  B  B <xsl:call-template name="makenode"/>
> B  B  B  B  B  B  B  B <tagX>data</tagX>
> B  B  B  B  B  B  B  B <tagY>data</tagY>
> B  B  B  B  B  B  B  B <xsl:call-template name="makenode"/>
> B  B  B  B </output>

I think, you have a notion that the earlier call-template above is
oddly numbered and the next one is an even numbered call. Solving this
in the strictest sense you wrote, is not possible unless we keep a
variable somewhere for counting, which can be incremented each time we
make a call to call-template.

If you are ready to use a Java extension (to keep a shared state),
almost any kind of counters can be implemented (please see an example
of this on my web page,
http://gandhimukul.tripod.com/xslt/extensions.html. - no 2).

But using an extension function to maintain shared state should be
used as a last resort, as it is against the spirits of functional
oriented and side effect free programming (which is one of the goals
of XSLT).

After knowing your input XML and the required output, though it might
be possible for us to comment if there could be a better way to solve
the problem.


--
Regards,
Mukul Gandhi

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-2011 All Rights Reserved.