This is good to know. I never would have thought of util:eval since I tend to reflexively avoid it at all costs, but it does seem a good fit for the general problem. I can see that one would have to be careful of the potential security ramifications, so I'll think about this for future projects for now. Thanks for the replies!
This sounds like a good use case for util:eval(). You'd construct the
> My question is, is there a better way to run this query without having to
> unroll it like this? Here's my eXist version information:
XPath expression dynamically as a string and then use util:eval() to
execute the expression.
let $path := concat('$xml-doc//', '$filter')
let $filter-nodes := util:eval($path)
For security reasons you'd want to be sure you carefully controlled $filter.