Re: [xsl] ancestor::* and for-each

Subject: Re: [xsl] ancestor::* and for-each
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 28 Jul 2010 12:33:34 -0400
At 2010-07-28 18:11 +0200, Wolfgang Laun wrote:
I use ancestor-or-self::* to obtain the node sequence from some node
to the document root.

Remember in XSLT it is ordered in document order even though it was addressed in XPath in reverse document order.


The outermost/top element of the document isn't interesting, so I add
a predicate, and I find that this works:
   [position() != last()]

Actually position()>1 will omit the document element.


Apparently, the sequence goes from leaf to root, which is the closing
tag order, as it should be.

Really? I would have expected your node list to be in document order.


Then, I iterate over the sequence, and now the nodes are processed
from root to leaf, which is strange.

No, that is what I would expect.


There is a Note in Chapter 7, Repetion, that sounds as if it is
related to this, but, frankly, I don't understand it.
What does it mean, in monosyllabic words, please ;-)

I hope this helps: "in XSLT a node set is ordered in document order even though it was addressed in XPath in reverse document order".


. . . . . . . . Ken

--
XSLT/XQuery training:   after http://XMLPrague.cz 2011-03-28/04-01
Vote for your XML training:   http://www.CraneSoftwrights.com/s/i/
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Current Thread