[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: What does 'reverse document order' mean?

Subject: Re: What does 'reverse document order' mean?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 15 Nov 2000 09:25:01 GMT
mean siblings
> Am I guilty of muddled thinking, or inadequate study of the spec?  Or is
> there some subtlety that I am missing?

guilty of uuencoding an example that was small enough to inline:-)

> since preceding-sibling:: selects siblings in
> 'reverse document order', the first node in the set

Note that node sets are called sets (rather than lists) on purpose, not
by accident. They are intrinsically unordered. 

[1] in a step selects the first node in the direction specified by the
axis used in the step, but anywhere else it refers to document order.

so 

preceding-sibling::elt[1]
  selects the immediately preceding elt sibling,
but
(preceding-sibling::elt)[1]
  selects the first elt sibling in document order.

You did 
 <xsl:variable name="sibling-preceders" select="preceding-sibling::elt"/>
   <xsl:for-each select="$sibling-preceders">
   <xsl:value-of select="."/> <xsl:if test="position()&lt;last()"> 

which is like 

(preceding-sibling::elt)[position() &lt; last()]

so position() and last() refer to document order here.

To see _why_ it has to be that way (other than because that was the will
of the w3c)

consider

 <xsl:variable name="sibling-preceders" 
    select="preceding-sibling::elt|../*[@id]"/>

now the variable contains all the preceding elts (which were "collected
backwards" and all sibling elements with an id attribute (which were
collected forwards) note these two sets overlap but | is set union,
an elt with an id is selected by both clauses, but only appears in the
node set once. So a constructed node set is justa set of nodes, each
individual node doesn't "remember" what axis was used to select it.

So if you caome later to apply a position() construct to the node set,
at that point the set is considered in document order.



David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet delivered
through the MessageLabs Virus Control Centre. For further information visit
http://www.star.net.uk/stats.asp


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.