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

Re: Document order for keys?

Subject: Re: Document order for keys?
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Mon, 10 Nov 2003 13:28:22 +0000
Re:  Document order for keys?
Hi James,

> When finding the first of a group of keys: key(?ve-by-firstocc?,
> substring(entrydata[3]/text, 1, 1))[1] would this find the first
> node in document order or the order which its puts the list in (e.g.
> if its alphabetical).

In XPath/XSLT 1.0, nodes are collected together in *sets*, which don't
have any inherent order. When you use a positional predicate on a
node-set (as opposed to using a positional predicate within a step),
then the nodes are always counted in document order. So:

  $node-set[1]

always gives you the first node in $node-set in document order, no
matter how the $node-set was generated.

So to answer your question, you will get the first node in document
order.

In XPath/XSLT 2.0, expressions return sequences, which *do* have an
inherent order. Some expressions may return a sequence of nodes in an
order other than document order. However, backwards compatibility has
been retained: calls to XPath/XSLT 1.0 functions such as key() always
return a sequence of nodes in document order.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 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.