W3C home > Mailing lists > Public > www-xpath-comments@w3.org > January to March 2002

RE: Order of results

From: Kay, Michael <Michael.Kay@softwareag.com>
Date: Fri, 11 Jan 2002 00:44:09 +0100
Message-ID: <DFF2AC9E3583D511A21F0008C7E6210622B8EE@daemsg02.software-ag.de>
To: "'James Swift'" <Swift@altova.com>, www-xpath-comments@w3.org
At XPath 1.0 the order of the result is undefined: the results form a
node-set, which can be in any order. Most operations on a node-set, however,
process the nodes in document order, so it's sensible for the XPath
processor to hold the node-set in document order where possible.

In XPath 2.0 the result of a path expression is defined to be a sequence of
nodes in document order.

Mike Kay

> -----Original Message-----
> From: James Swift [mailto:Swift@altova.com]
> Sent: 10 January 2002 13:28
> To: www-xpath-comments@w3.org
> Subject: Order of results
> 
> 
> 
> Hi,
> 
> I have a question about the order of an XPath's results 
> (assuming a node set result)
> 
> for the following xml,
> 
> <a>
> 	<b>
> 		<c>
> 			<d/>
> 			<e/>
> 			<f/>
> 		</c>
> 		<c>
> 			<d/>
> 			<e/>
> 			<f/>
> 		</c>
> 		<c>
> 			<d/>
> 			<e/>
> 			<f/>
> 		</c>
> 	</b>
> </a>
> 
> the XPath,
> 	descendant-or-self::node()
> would yield a node set in the folowing order,
> 
> 	(root node),a,b,c,d,e,f,c,d,e,f,c,d,e,f
> 
> now if we added /child::* to the end of our XPath, i.e.,
> 	descendant-or-self::node()/child::*
> 
> should the results be in document order, i.e.,
> 
> 	a,b,c,d,e,f,c,d,e,f,c,d,e,f
> 
> or should the children of each node be found and added to our 
> result as they are found, i.e.
> 
> (child::*) Go through each of the nodes from 
> descendant-or-self::node(),
> 
> children of (root)	= a
> children of a		= b
> children of b		= c, c, c
> 
> and so on resulting in the following,
> 
> 	a,b,c,c,c,d,e,f,d,e,f,d,e,f
> 
> thanks,
> 
> James
> 
> ... James Swift
> ... Developer
> ... Altova GmbH - The XML Spy Company
> 
> ===================================================================
> XML Spy 4.2 Suite: the original award-winning IDE, Document Editor,
> XSLT Designer,  Browser Plug-In, XML Schema Editor, and SOAP Tester
> Visit  <www.xmlspy.com>  to download your free evaluation copy today!
> ===================================================================
> 
> The information transmitted in this message and/or as an attachment
> to it  is intended  only for the  person or  entity to  which it is
> addressed and may contain confidential  and/or privileged material.
> Any  review,  retransmission,  dissemination  or  other use of,  or
> taking of any action in reliance upon,  this information by persons
> or entities other than the intended recipient is prohibited. If you
> received this in error,  please contact  the sender  and delete the
> material from any computer.  Altova GmbH  and  Altova, Inc.  do not
> accept legal responsibility  for the contents of this message.  Any
> views or opinions  presented are solely  those of the author and do
> not  necessarily  represent those of  Altova GmbH and  Altova, Inc.
> unless otherwise specifically stated. Thank you!
> 
Received on Thursday, 10 January 2002 18:44:17 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 3 October 2007 16:05:54 GMT