Re: Counter variable

Mike Brown <[email protected]>
Newsgroups gmane.text.xml.xslt.extensions
Message-ID <[email protected]>
Morgan, Lee wrote:
> I don't have much experience with xsl, but I have a template the reads a
> variable number of lines from an xml file and was wondering if there is
> anyway to keep track of how many lines were read and which one is currently
> being read.  I need to do something different on line three than the rest of
> the lines and don't know of a good way to do it.

This is a question for xsl-list, the general forum for discussion of XSLT.
The exslt list is for discussion of EXSLT, which is a specification for a
library of common extensions to XSLT.

As for your question, XSLT operates on a DOM-like node tree model that comes
from a fully parsed XML document. There's no standard way in XSLT to know what
line in the original XML source the node you're processing came from, and
there's certainly no way to force the processing of nodes that came from
specific lines. I suspect that the template you have does not actually do what
you think it does, and in all likelihood, your problem can be refactored into
something that doesn't require a literal interpretation of the XML source.

Post your question to xsl-list and include some sample XML for input and a
sample of your desired output, and someone will help you get from here to
there.

xsl-list info is at http://www.mulberrytech.com/

-Mike
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.