Hi Andreas, I don't know whether I correctly understood you use-case but what about going with hof functions [1]? Maybe your code could turn to something as simple as
declare function local:topath($path){ let $pathseg := tokenize($path, "/") return fold-left($pathseg, (), function($out, $segment){ if($segment = "." or $segment = "") then $out else if($segment = "..") then $out[position() lt count($out)] else ($out, $segment) }) }; local:topath("/a/b/c/../../../g")
Regards, Marco.
[1] http://docs.basex.org/wiki/Higher-Order_Functions
On 01/04/19 15:49, Andreas Mixich wrote:
I think, I am finding it...
I replaced the first expression with
`prof:dump(concat("in: ", $path, " out: ", string-join(array:flatten($out)))),`
and this gives me more info. So I may be able to solve this alone.