Re: [xquery-talk] Building a tree from sequence of maps

2019-12-30 Thread Andreas Mixich
Staying away from an issue for a few days can be quite clearing! When I revisited the task, I saw it right on! Or so I think... This is the solution I came up with: declare variable $local:xml := ; declare function local:get-parents($item) {

Re: [xquery-talk] Building a tree from sequence of maps

2019-12-21 Thread Andreas Mixich
Hello, thank you for the example. I am totally fine with the HOF style. I have access to XQ3.1 (BaseX and Saxon-PE/EE with oXygen) There is still a thing, that I need to solve, namely how to get aligned, that's why I will follow up to this in the next days, since I have drained out for now.

Re: [xquery-talk] Building a tree from sequence of maps

2019-12-21 Thread Michael Kay
Start with a function that gets the children of an item: declare variable $children := function($item) {return $xml / item[@refid = $item / @id ]}; Decide where to start: declare variable $root := $xml / item[1]; Now process the items recursively: declare function local:process-item($item,

[xquery-talk] Building a tree from sequence of maps

2019-12-21 Thread Andreas Mixich
Hi, I feel like I try to get a hold on a piece of wet soap with this... Background: Atom Syndication has an extension[1], which allows threading of entries. These entries are ordered in a flat sequence, one by one. As a result we end up with an Atom feed, that has a bunch of entries, where each