W3C home > Mailing lists > Public > www-ql@w3.org > July to September 2003

Re: creation order vs. document order

From: Torsten Grust <Torsten.Grust@uni-konstanz.de>
Date: Tue, 23 Sep 2003 15:41:09 +0200
Message-ID: <16240.19829.91652.881678@gargle.gargle.HOWL>
To: Jan Hidders <jan.hidders@ua.ac.be>
Cc: www-ql@w3.org

Hello,

On September 23 (15:35 +0200), Jan Hidders wrote with possible deletions:
| [...]
|    for $a in $list1
|    for $b in $list2
|    where $a/name = $b/name
|    return <c> $a, $b </c>
|
| Must the result of this always be a list that is sorted in document
| order? Intuitively I would expect them to be sorted in the order in
| which they were created, but as far as I can tell the formal semantics
| leaves this unspecified.

Your expectation is met: the resulting list of <c> elements is in
creation order as you name it.  Document order sorted node lists are
created when XPath location steps are applied to a given (however
sorted) sequence of context nodes.  This does not apply for your
example, however.

My students stumble about the distinction all the time:

                 $list/axis::nodetest

is not equivalent to

                 for $n in $list
                    return $n/axis::nodetest

Best wishes,
   --Torsten

--
  | Dr. Torsten Grust                          Torsten.Grust@uni-konstanz.de |
  |                                   http://www.inf.uni-konstanz.de/~grust/ |
  | Database Research Group, University of Konstanz (Lake Constance/Germany) |
  |             (Please avoid sending me MS Word or PowerPoint attachments.) |
Received on Tuesday, 23 September 2003 09:41:11 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:17:16 UTC