[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|