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>
=============================================