Bug in document order

Monday, 29 October 2012 · 2 messages
HR
Hans-Juergen Rennau29 Oct 2012 22:04 #
Hello, I noticed a little bug concerning document order. Consider this input:
=== in.xml ====================================
<section>
   <title>Some title</title>
</section>
============================================

and the following query, which
(a) extends the contents of <section> by a <para> element (=> $result)
(b) and then makes a simple copy of the intermediate result (=> $copy):
=== problem.xq =============================== let $in := /*
let $result :=
      element {node-name($in)} {
         $in/*,
         <para>APPENDED ELEMENT</para>
      }

let $copy :=
      element {node-name($result)} {$result/*}

return
   <wrap>{
      <result>{$result}</result>,
      <copy>{$copy}</copy>
   }</wrap>
============================================= Launching the query basex -i in.xml problem.xq one gets a result in which the contents of $copy are in the wrong order (<para> comes now before <title>, though it should come last). Kind regards, Hans-Juergen The query result:
=============================================
<wrap>
  <result>
    <section>
      <title>Some title</title>
      <para>APPENDED ELEMENT</para>
    </section>
  </result>
  <copy>
    <section>
      <para>APPENDED ELEMENT</para>
      <title>Some title</title>
    </section>
  </copy>
</wrap>
=============================================
CG
Christian Grün29 Oct 2012 23:43 #
Hans-Jürgen, thanks for the compact example. I reduced it to the following input and query.. XML x.xml: <A/> Query x.xq:
let $out := element x { ., <B/> }
return $out/*
Command: basex -ix.xml x.xq ..and recorded it as a GitHub issue [1]. We’ll let you know when the bug has been fixed. Christian [1] https://github.com/BaseXdb/basex/issues/588
Quoted text · Hans-Juergen Rennau · 67 lines
On Mon, Oct 29, 2012 at 10:04 PM, Hans-Juergen Rennau <hrennau at yahoo.de> wrote: > Hello, > > I noticed a little bug concerning document order. Consider this input: > > === in.xml ==================================== > <section> > <title>Some title</title> > </section> > ============================================ > > and the following query, which > (a) extends the contents of <section> by a <para> element (=> $result) > (b) and then makes a simple copy of the intermediate result (=> $copy): > > === problem.xq =============================== > let $in := /* > > let $result := > element {node-name($in)} { > $in/*, > <para>APPENDED ELEMENT</para> > } > > let $copy := > element {node-name($result)} {$result/*} > > return > <wrap>{ > <result>{$result}</result>, > <copy>{$copy}</copy> > }</wrap> > ============================================= > > Launching the query > basex -i in.xml problem.xq > > one gets a result in which the contents of $copy are in the wrong order > (<para> comes now before <title>, though it should come last). > > Kind regards, > Hans-Juergen > > The query result: > ============================================= > <wrap> > <result> > <section> > <title>Some title</title> > <para>APPENDED ELEMENT</para> > </section> > </result> > <copy> > <section> > <para>APPENDED ELEMENT</para> > <title>Some title</title> > </section> > </copy> > </wrap> > ============================================= > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >

⚡Generated with XQuery