BaseX 9.3: The Winter Edition; {position()>1] vs. [./position()>1
Monday, 2 December 2019 · 3 messages · last reply 5 Dec 2019
AW
Alexander Witzigmann2 Dec 2019 19:25 #
the results of equivalent semantics:
e.g.
//row[position()>1]
is no more equal to in latest 9.3 release to
//row[./position()>1]
the later results in not correct result.
Alex
CG
Christian Grün2 Dec 2019 21:07 #
Hi Alex,
Could you share a little self-contained example with us that demonstrates the wrong behavior, and name the versions of BaseX you tested?
The two following expressions are equivalent:
//row[position() > 1]
/descendant-or-self::node()/child::row[position() > 1]
They are not equivalent to:
//row[./position() > 1]
/descendant-or-self::node()/child::row[./position() > 1]
Each result of child::row will be bound one by one to the context item in the predicate, thus ./position() will always yield 1.
You can run the following queries to see the difference:
(<a/>,<b/>)[trace(position())],
(<a/>,<b/>)[trace(./position())]
Does this help?
Christian
Quoted text · Alexander Witzigmann · 17 lines
On Mon, Dec 2, 2019 at 7:25 PM Alexander Witzigmann <alexander.witzigmann at tanner.de> wrote: > > the results of equivalent semantics: > > e.g. > > //row[position()>1] > > is no more equal to in latest 9.3 release to > > //row[./position()>1] > > the later results in not correct result. > Alex > >
AW
Alexander Witzigmann5 Dec 2019 10:39 #
you are absolutely right - the old the old basex version (9,2,4) considered both statements as equal.
This means - the issue was in 9.2.4 and is fixed in 9.3 ... sometimes existing code makes existing bugs accessible as features
thanks in advance
alex
Quoted text · Christian Grün · 45 lines
Am 02.12.2019 um 21:07 schrieb Christian Grün: > Hi Alex, > > Could you share a little self-contained example with us that > demonstrates the wrong behavior, and name the versions of BaseX you > tested? > > The two following expressions are equivalent: > > //row[position() > 1] > /descendant-or-self::node()/child::row[position() > 1] > > They are not equivalent to: > > //row[./position() > 1] > /descendant-or-self::node()/child::row[./position() > 1] > > Each result of child::row will be bound one by one to the context item > in the predicate, thus ./position() will always yield 1. > > You can run the following queries to see the difference: > > (<a/>,<b/>)[trace(position())], > (<a/>,<b/>)[trace(./position())] > > Does this help? > Christian > > > On Mon, Dec 2, 2019 at 7:25 PM Alexander Witzigmann > <alexander.witzigmann at tanner.de> wrote: >> the results of equivalent semantics: >> >> e.g. >> >> //row[position()>1] >> >> is no more equal to in latest 9.3 release to >> >> //row[./position()>1] >> >> the later results in not correct result. >> Alex >> >>
Written for BaseX 9.3. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery