Hi,

I am extensively using a function wrapping xquery:eval. My use case is roughly the following :

declare function local:eval_helper($exp, $args){xquery:eval('$xml'||$exp,map{'$xml' := $args})};
declare variable $test := <toto><tata>1</tata></toto>;
local:eval_helper3('//tata', $test)


Since the following correction : [1] https://github.com/BaseXdb/basex/issues/833, the previous code raises now a  [XPST0008] Undefined variable $xml.

I have tried several combinations to find a workaround, none are working :

- declare function local:eval_helper($exp, $args){xquery:eval(''||$exp,map{'' := $args})};  
([XPDY0050] Root of the context item must be a document node.).
- declare function local:eval_helper($exp, $args){xquery:evaluate($arg||$exp)};  
[XPTY0019] Steps within a path expression must yield nodes; xs:integer found.
-- declare variable $xml external := "xml", [XPST0008] Undefined variable $xml.

What is the correct workaround ? 


Cheers

Jean-Marc