- From: Jonathan Robie <jonathan.robie@datadirect.com>
- Date: Tue, 17 Aug 2004 14:14:41 -0400
- To: "Mark D. Anderson" <mda@discerning.com>
- CC: public-qt-comments@w3.org
Mark D. Anderson wrote: > >>>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. Yes. > 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). Yes. > 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:"..... Yes, this works too. And this was used in examples that motivated modules. Jonathan
Received on Tuesday, 17 August 2004 18:15:17 UTC