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

RE: Nasty XPath expressions

nasty expressions
> From: Michael Kay [mailto:michael.h.kay@n...]


> And a point of detail, which I think Evan Lenz already 
> commented on: XPath
> 1.0 doesn't say the nodes must be sorted in document order, 
> and there are
> many cases where sorting is unnecessary. For example, many 
> operations only
> require selection of the node that is first in document 
> order, which can be
> found without doing a sort.

I think confusion has come in due to an inconsistency between the notion of
a node-set being unordered, and the fact that XSLT can process node-sets as
if they are ordered. For instance, the "for-each" element will process the
nodes in the node-set returned by its "select" expression in document order
(unless it contains child "sort" elements, in which case they determine the
order of processing).

This seems odd that XSLT can treat node-sets as if they are ordered, even
though they are not. I think this is probably what has led to the
misconception (which I shared) that node-sets are ordered.

I'm curious as to the reasoning behind specifying that XSLT implementations
must have some opaque knowledge of the document order of nodes in a
node-set, yet not expose that information in the node-set itself. Was this
done simply to protect XPath implementations that are not XSLT-based from
having to preserve document order in node-sets?


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.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.