All I have to do is post to this list, and within seconds of reading my
own post, I can see what's wrong. Doh.
The call to the function is missing the $inDoc parameter.
Cheers,
Martin
Martin Holmes wrote:
> Hi all,
>
> I'm trying to import an XQuery module into another module, and call one
> of its functions, and I can't figure out why it's failing. I have this
> module in a file called mdhUtils.xqm:
>
> ----------------------------
> xquery version "1.0";
>
> module namespace mdhUtils="http://www.mholmes.com/namespaces/mdhUtils";
>
> declare function mdhUtils:getRelatedItems($inDoc as element()) as element()?
> {
> [... do stuff ...]
> };
> ---------------------------
>
> Then I import that module into another module using a filesystem
> relative URI:
>
> import module namespace
> mdhUtils="http://www.mholmes.com/namespaces/mdhUtils" at "xq/mdhUtils.xqm";
>
>
> The import works (I don't get any "can't find file" errors, although if
> I change the URI, I do get them).
>
> Then I try to call the function in the module:
>
> declare variable $relDocs := mdhUtils:getRelatedItems();
>
> and I get this error:
>
> org.exist.xquery.XPathException: Function mdhUtils:getRelatedItems() is
> not defined in namespace 'http://www.mholmes.com/namespaces/mdhUtils'
>
> Can anyone suggest what I might be doing wrong here?
>
> Cheers,
> Martin
>
>
> ------------------------------------------------------------------------------
|