Subject: Re: [xsl] round-robin template call From: Mukul Gandhi <gandhi.mukul@xxxxxxxxx> Date: Sun, 5 Apr 2009 23:06:49 +0530 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] round-robin template call, Emmanuel Bégué | Thread | [xsl] Count number of specific chil, himanshu padmanabhi |
Re: [xsl] round-robin template call, G. Ken Holman | Date | RE: [xsl] round-robin template call, Emmanuel Bégué |
Month |