Hi Jens,
thank you for your immediate reply.
Is this kind of evaluation specific to BaseX? All other XQuery/XPath processors I know don't require parenthesis to produce the result I expect.
Usually, a predicate is part of the location step. On the descendant axis, all selected nodes are numbered in depth first order and position() evaluates to the number of the context node. Thus, /descendant::c[1] should return the first c node because there is only one node with position number 1.
Best regards,
Martin
Am 09.11.2010 22:25, schrieb Jens Erat:
Hi Martin,
the predicate gets evaluate for each result of the XPath-step. BaseX's
output is expected.
The query you wanted to perform is (/descendant::c)[1] which only
returns the first result over all.
Best regards,
*Jens Erat*
* » *web:* www.jenserat.de <http://www.jenserat.de>
* » *email:* jens.erat@uni-konstanz.de
<mailto:jens.erat@uni-konstanz.de>
* » *phone:* 0151 56961126 <callto:+4915156961126>
* » weitere und aktuelle *Kontaktmöglichkeiten:*
www.jenserat.de/kontakt <http://www.jenserat.de/kontakt>
Am 09.11.2010 um 22:18 schrieb Martin Gieseking:
Hi,
while playing around with BaseX, I stumbled over some weird results in
conjunction with positional predicates on the descendant axis. As far
as I can see, there seems to be a bug in the evaluation of function
position().
Example:
When I load the following XML document and evaluate the path
expression /descendant::c[1], both c element nodes are returned, but
only the first one is expected. So, currently the result is identical
to that of //c[1].
<a>
<b>
<c/>
</b>
<b>
<c/>
</b>
</a>
Best regards,
Martin
_______________________________________________
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
<mailto:BaseX-Talk@mailman.uni-konstanz.de>
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
_______________________________________________
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.dehttps://mailman.uni-konstanz.de/mailman/listinfo/basex-talk