Re: [xsl] How to mark every 5th output record.

Subject: Re: [xsl] How to mark every 5th output record.
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 11 Mar 2008 14:11:46 GMT
> Is there really, really, really _any_ other way of doing this without making
> a 3rd copy of my data set?

Are you restricted to use xslt 1 (this won't necessarily change the
answers, but it might)

If you want to use position() to do the numbering then you need to
iterate over a set of nodes in teh right sequence, so that probably does
mean that you want to copy teh nodes.

If on the other hand that's too expensive and you want to maintain a
counter that you add "by hand" each time you do something then you can
do that as well, but as that means that the processing of one record
depends on teh previous record you must change the idiom, you can't use
a for-each as that (essentially) is only for parallel processing where
each item is processed independently. Instead you need to make a named
template that has a parameter count, which processes one record, then
calls itself with <xsl:with-param name="count" select="$count+1"/>

David


________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

Current Thread