three questions regarding library modules

1. Section 4.12 of WD-xquery-20040723 indicates that a library module
can only declare variables in its own namespace, and that
unprefixed variables can only be declared in a main module.

But what does this mean about using unprefixed variables in a
library module?
If a main module has:

declare variable $mainvar = 'fred';
import module foo = "http://whatever.org/modules/foo" at "foo.xq";

Should foo.xq allow:

module namespace foo = "http://whatever.org/modules/foo";
declare function foo:getmain() {$mainvar};

2. I am similarly confused by section 4.11.
Should a library module be able to use a namespace declared
in a main module?
Is it legal for it to provide its own definition?

An example main module might be:

declare namespace bar = "http://whatever.org/namespaces/bar";
import module foo = "http://whatever.org/modules/foo" at "foo.xq";

and foo.xq would then be:

module namespace foo = "http://whatever.org/modules/foo";
(:declare namespace bar = "http://whatever.org/namespaces/bar";:)
declare function foo:getbar() {<bar:root/>};

3. In section .43, I'm unclear as to whether the "local" prefix
is legal in a library module. It says:

    In order to allow main modules to declare functions for local use
    within the module
    without defining a new namespace, XQuery predefines the namespace
    prefix local to
    the namespace http://www.w3.org/2004/07/xquery-local-functions, and
    reserves this namespace for use in defining local functions.

I hope this doesn't mean that it is impossible/illegal to define
local functions in a library module.

Thanks....

-mda

Received on Tuesday, 17 August 2004 00:52:28 UTC