Op 27-05-2024 12:41 CEST schreef Christian Grün <christian.gruen@gmail.com>:Hi Rob,I think there are various way to achieve that. One way is to store both the full document in the session as well as the path to the requested node:let $xml := <data><bla><blu/></bla></data>
let $result := $xml//blu
let $path := path($result)
return (
session:set('xml', $xml),
session:set('xml', $path)
)You can run a dynamic query on the XML snippet to get back your original result:let $xml := session:get('xml')
let $path := session:get('path')
let $result := xquery:eval($path, { '': $xml })return $resultBest,Christian
On Sat, May 25, 2024 at 8:45 AM Rob Stapper <r.stapper@lijbrandt.nl> wrote:Hi Christian,I'm looking for a way to store a xml-subelement during a session as a subelement and not as a rootelement. The store- and the session:set-function save xml-elements as a root-elements, loosing the origional root.My casus is that I have this batch-webservice that I want to turn into a online/interactive-webservice. The application makes use of the root- and ancestor functions/axis on xml-subelements. In the batch solution I have access to the origional xml-subelement. In the online-solution however I have not. This because the code is broken up due to a http-request/response interaction with the user. I would like the xml-subelement to survive this http-excursion in a way that its root-element stays available and the root- and ancestor-function gives the same result as in the batch-version.Do you have any suggestions on this?mvgr. Rob Stapper
mvgr. Rob Stapper