Hi,

It seems that I've found a bug concerning spawned functions and external
variables.

In a module with an external variable I spawn a function. The spawned
function calls another function which fails with XDMP-EXTVAR when accessing
the external variable.
Here is a small example (main.xqy):
xquery version "1.0-ml";
declare variable $param as xs:string external;

declare function local:func() {
    xdmp:log("value: " || $param)
};

xdmp:spawn-function(function() { local:func() })


I call main.xqy using the following snippet:
xquery version "1.0-ml";
xdmp:invoke("main.xqy", (xs:QName("param"), "foo"))

This leads to the following error:

XDMP-EXTVAR: (err:XPDY0002) declare variable $param as xs:string
external;  -- Undefined external variable fn:QName("","param")

I've also found out that accessing the external variable directly in the
spawned function works. Working version of main.xqy:
xquery version "1.0-ml";
declare variable $param as xs:string external;

xdmp:spawn-function(function() { xdmp:log("value: " || $param) })

Regards,
Andreas

-- 
Andreas Hubmer
IT Consultant
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to