Re: three questions regarding library modules

> > 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};
> 
> foo.xq has no way to import the main module. If you aren't a library 
> module, you can't be imported. So there's no way for foo.xq to get 
> access to $mainvar.

And since module import can't be recursive, it can't get it via
a function defined in the main module either.

I guess the ways a library module can get data is:

1. passed in as a function call argument.

2. from calling a function or accessing a variable
that is available to both the main module and the library
module (main imports C and library imports C).

xquery implementations I've played with so far seem to 
not support setting an external variable that has a
prefix. When that is the case, it would seem that
a library module only has mechanism (1) to get the
information?

Otherwise I could make up a library module called
vars.xq that puts all the external variables in some
"vars" namespace, and then the main module and all
library modules could use the same variables, all
prefixed with "vars:".....

-mda

Received on Tuesday, 17 August 2004 17:30:58 UTC