xsl-list
[Top] [All Lists]

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

2008-03-11 07:44:51
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(_at_)nag(_dot_)co(_dot_)uk] 
Sent: Tuesday, March 11, 2008 10:12 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] 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. 
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--