xquery - Ordering of nodes after in memory update with mem:insert-child() is inconsistent -
i using ryan dew's xquery module (https://github.com/ryanjdew/xquery-xml-memory-operations) marklogic v8.0-5 perform in-memory updates document.
the following code sample replicates problem experience when use insert-child() operation. elements inserted insert-child() should reflect insertion order, find not. in other words, elements should ordered one, two, three, four, 5 in output. instead, order appears random.
let $x := <root><original-container><one/><two/><three/><four/><five/></original-container><new-container/></root> let $tx := mem:copy($x) let $_ := $item in $x/original-container/* return ( xdmp:set( $tx, mem:delete($tx, $item) ) , xdmp:set( $tx, mem:insert-child($tx, $x/new-container, $item) ) ) return mem:execute( $tx )
i may misusing code library--in particular, creating transaction map , resetting xdmp:set()
after each insert-child()
operation. perhaps not correct?
i apologize, bug in code. expression returning nodes in "document order" , across documents can appear random. i've committed fix , more details can found @ the ticket on github.
Comments
Post a Comment