- From: Torsten Grust <Torsten.Grust@uni-konstanz.de>
- Date: Tue, 23 Sep 2003 15:41:09 +0200
- 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