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


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:


is not equivalent to

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

Best wishes,

  | 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.4.0 : Friday, 17 January 2020 22:43:43 UTC