XPath child::node() axis sequence order

Tuesday, 10 December 2013 · 4 messages · last reply 12 Dec 2013
TR
Tojo Rakotoarison10 Dec 2013 13:55 #
Hi ! In BaseX, is the result of the child::node() axis always in document-order ? Thanks !
-- Tojo Rakotoarison *@tojo_rs <https://twitter.com/#%21/tojo_rs>*
CG
Christian Grün10 Dec 2013 14:02 #
Quoted text · Tojo Rakotoarison · 1 line
> In BaseX, is the result of the child::node() axis always in document-order ?
The nodes will be in document order if child::node() is part of a path expression (..../....). All the nifty details can be found in the spec [1]. Christian [1] http://www.w3.org/TR/xquery-30/#id-path-operator
CG
Christian Grün10 Dec 2013 16:18 #
Hi Wendell (cc @basex-talk), thanks for your mail. Yes, there are cases in which the result of an axis step are not returned in document order. One such example is shown as follows: Document Order:
<A>
  <B><c/></B>
  <c/>
</A>//c / parent::node()

No document order (when using the map operator):
<A>
  <B><c/></B>
  <c/>
</A>//c ! parent::node()
I was using parent::node() instead of child::node() here, but the example can surely be adapted to also include a child step. Hope this helps? Christian
Quoted text · Wendell Piez · 38 lines
On Tue, Dec 10, 2013 at 3:22 PM, Wendell Piez <wapiez at wendellpiez.com> wrote: > Dear Christian, > > Since a path expression consists of "one or more steps" > (http://www.w3.org/TR/xquery-30/#dt-path-expression), then isn't > 'child::node()' itself a path expression? > > I'm not asking to be pedantic. To restate the OP's question, "are > there any circumstances in BaseX under which 'child::node()' will > return a sequence of nodes not in document order?" > > If so, this is easily fixed ... child::node()/. ... but does one ever > need to take such care? (In XPath generally, the answer as I > understand it would be "no".) > > Cheers, Wendell > > Wendell Piez | http://www.wendellpiez.com > XML | XSLT | electronic publishing > Eat Your Vegetables > _____oo_________o_o___ooooo____ooooooo_^ > > > On Tue, Dec 10, 2013 at 8:02 AM, Christian Grün > <christian.gruen at gmail.com> wrote: >>> In BaseX, is the result of the child::node() axis always in document-order ? >> >> The nodes will be in document order if child::node() is part of a path >> expression (..../....). All the nifty details can be found in the spec >> [1]. >> >> Christian >> >> [1] http://www.w3.org/TR/xquery-30/#id-path-operator >> _______________________________________________ >> BaseX-Talk mailing list >> BaseX-Talk at mailman.uni-konstanz.de >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
TR
Tojo Rakotoarison12 Dec 2013 17:19 #
Thanks ! I had a problem with BaseX 7.6 : something strange, where child nodes seemed to be returned in a different order with something like $node/node(). When I tried to display $node, the order of the children were correct, but when I tried to display $node/node(), it was different. But finally, i updated to BaseX 7.7.2 and now it works fine as expected. But thanks for your feedback ! 2013/12/10 Christian Grün <christian.gruen at gmail.com>
Quoted text · Christian Grün · 70 lines
> Hi Wendell (cc @basex-talk), > > thanks for your mail. Yes, there are cases in which the result of an > axis step are not returned in document order. One such example is > shown as follows: > > Document Order: > <A> > <B><c/></B> > <c/> > </A>//c / parent::node() > > No document order (when using the map operator): > <A> > <B><c/></B> > <c/> > </A>//c ! parent::node() > > I was using parent::node() instead of child::node() here, but the > example can surely be adapted to also include a child step. > > Hope this helps? > Christian > ___________________________ > > On Tue, Dec 10, 2013 at 3:22 PM, Wendell Piez <wapiez at wendellpiez.com> > wrote: > > Dear Christian, > > > > Since a path expression consists of "one or more steps" > > (http://www.w3.org/TR/xquery-30/#dt-path-expression), then isn't > > 'child::node()' itself a path expression? > > > > I'm not asking to be pedantic. To restate the OP's question, "are > > there any circumstances in BaseX under which 'child::node()' will > > return a sequence of nodes not in document order?" > > > > If so, this is easily fixed ... child::node()/. ... but does one ever > > need to take such care? (In XPath generally, the answer as I > > understand it would be "no".) > > > > Cheers, Wendell > > > > Wendell Piez | http://www.wendellpiez.com > > XML | XSLT | electronic publishing > > Eat Your Vegetables > > _____oo_________o_o___ooooo____ooooooo_^ > > > > > > On Tue, Dec 10, 2013 at 8:02 AM, Christian Grün > > <christian.gruen at gmail.com> wrote: > >>> In BaseX, is the result of the child::node() axis always in > document-order ? > >> > >> The nodes will be in document order if child::node() is part of a path > >> expression (..../....). All the nifty details can be found in the spec > >> [1]. > >> > >> Christian > >> > >> [1] http://www.w3.org/TR/xquery-30/#id-path-operator > >> _______________________________________________ > >> BaseX-Talk mailing list > >> BaseX-Talk at mailman.uni-konstanz.de > >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
-- Tojo Rakotoarison *@tojo_rs <https://twitter.com/#%21/tojo_rs> *

⚡Generated with XQuery