[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: How to mark every 5th output record.
Well, I am using the gnome xslt processor with exslt extensions (of which I need various math functions, and node-set) recompiled into a custom xslt processor running on an embedded device. I'd rather not try to integrate another processor simply because I can't do "counter=counter+1". As for your other suggestion... I will think about it. It would require significant rework to the 3K lines of code I already have. I currently don't use for-each, I use various forms of "template match" to process the records as they are encountered in the input stream. Nevertheless, it's giving me something to mull over. I'm still open to more suggestions... -----Original Message----- From: David Carlisle [mailto:davidc@xxxxxxxxx] Sent: Tuesday, March 11, 2008 10:12 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: How to mark every 5th output record. > 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. ________________________________________________________________________
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|