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

RE: simple XPath question

Subject: RE: simple XPath question
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Tue, 3 Jul 2001 09:29:22 +0100
RE:  simple XPath question
> Now that I think about it some more, I believe in the
> previous chapter the
> author wrote that elements in node-sets do not have an order.

This often confuses people. Nodes have an order, called document order.
Node-sets have no ordering of their own, but the nodes themselves still have
an order.

Think of it as being like sets of integers. {1,2,3} and {3,1,2} represent
the same set of integers, because the set has no ordering. But it's still
possible to ask for the "second-highest integer in the set", because
integers are ordered. Similarly in a set of <country> nodes, you can ask for
the <country> that is second in document order.

>  Thus it could
> not be that select='item/country' could select the two
> <country> nodes,
> country[1] being US and country[2] being Canada.
>
> And the position() values are really a separate thing
> entirely.  They are
> positions in the source tree, not in the node-set, since
> nodes in node-sets don't have positions.

No, quite the contrary. position() has nothing to do with the position of a
node in the source tree, it's the position of the node in the current node
list that matters. For example, if you do xsl:for-each with an xsl:sort,
it's the position of the node in sorted order.

Mike Kay
Software AG


 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.