[Monetdb-developers] preceding-sibling

Stefan Manegold Stefan.Manegold at cwi.nl
Wed Feb 20 00:39:51 CET 2008


Hi Djoerd,

from http://www.w3.org/TR/xpath20/
========
[...]
3.2.2 Predicates
[...]
Note:
When using predicates with a sequence of nodes selected using a reverse
axis, it is important to remember that the the context positions for such a
sequence are assigned in reverse document order. For example,
preceding::foo[1] returns the first qualifying foo element in reverse
document order, because the predicate is part of an axis step using a
reverse axis. By contrast, (preceding::foo)[1] returns the first qualifying
foo element in document order, because the parentheses cause
(preceding::foo) to be parsed as a primary expression in which context
positions are assigned in document order. Similarly, ancestor::*[1] returns
the nearest ancestor element, because the ancestor axis is a reverse axis,
whereas (ancestor::*)[1] returns the root element (first ancestor in
document order).
[...]
=======

i.e., (IMHO) MonetDB/XQuery 0.18 was wrong, MonetDB/XQuery 0.22 is right.

Stefan


On Tue, Feb 19, 2008 at 11:55:26PM +0100, Djoerd Hiemstra wrote:
> Hi there MonetDBs,
> 
> The results for the following query changed between v0.18 and v0.22:
> 
> let $list :=
> <list>
>   <item>1</item>
>   <item>2</item>
>   <item>3</item>
>   <item>4</item>
> </list>
> return $list//item[. = "4"]/preceding-sibling::*[1]
> 
> It now gives item 3, which I think is wrong since the results of any
> axis step (also preceding-sibling), should be in document order.
> The result in version 0.18 is item 1.
> 
> Best,  Djoerd.
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Monetdb-developers mailing list
> Monetdb-developers at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/monetdb-developers
> 
> 

-- 
| Dr. Stefan Manegold | mailto:Stefan.Manegold at cwi.nl |
| CWI,  P.O.Box 94079 | http://www.cwi.nl/~manegold/  |
| 1090 GB Amsterdam   | Tel.: +31 (20) 592-4212       |
| The Netherlands     | Fax : +31 (20) 592-4312       |




More information about the developers-list mailing list