Re: [xsl] How Can I Reference previous XML in Subsequent Iterations?

Subject: Re: [xsl] How Can I Reference previous XML in Subsequent Iterations?
From: "Chris M." <chris@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 18 Apr 2007 11:52:39 -0400
Well, here we have a node-set, not the layout in the original XML. In this case, it is the same, and crucial to the output.

I found out the hard way that a sorted node-set is not iterated in the sorted order, but the order in the original predicate. I am also limited to using XPath 1.0 (the libxslt implementation used in PHP 5), so I miss out on some very nice XPath 2.0 functions).

I now sort the original XML and eschew sorting in the stylesheet.

I'm always up for learning new ways of thinking, which is why I'm posting here, and risking being branded a n00b (a state which seldom lasts long for me).

On Apr 18, 2007, at 11:44 AM, David Carlisle wrote:


The main issues I have with the way XSLT
works is with the way states change all the time. For example, if I
want to compare a value to the value of the previous iteration in an
xsl:for-each loop,

The way that is phrased shows that you haven't really absorbed the xslt
processing model. there is no assumption that the nodes selected by the
select statement in a xsl:for-each are processed in any order. They can
be processed in any order, and in particular they can be processed in
parallel. thus the fact that you can not copy state changes from one
iteration to another is not some arbitrary restriction on the language,
it is just a natural consequence of the processing model.


David


Chris Marshall
chris at getridofthiswholelongthingybecauseitstoconfusescrapers littlegreenviper dot com
http://www.cmarshall.net/


Current Thread