basex
basex copied to clipboard
XQuery: Module imports are not transitive
The following function should raise an error:
(: b.xqm :)
module namespace b = 'b';
import module namespace c = 'c' at 'c.xqm';
(: c.xqm :)
module namespace c = 'c';
declare function c:hello(){
"can you see me now"
};
(: main.xq :)
import module namespace b = 'b' at 'b.xqm';
declare namespace c='c';
c:hello()
Original message: https://www.mail-archive.com/[email protected]/msg13873.html
Example from https://www.mail-archive.com/[email protected]/msg14507.html
In this case it appears an error, [XQST0049] Duplicate declaration of static variable, is raised by BaseX 9.7 when it should not be.
(: main.xq :)
import module namespace u = "u" at 'u.xqm';
import module namespace c = "c" at 'data/c.xqm';
$u:path
(: u.xqm :)
module namespace u="u";
declare variable $u:path:="somewhere";
(: data/c.xqm :)
module namespace c="c";
import module namespace u = "u" at 'u.xqm'; (: cf '../u.xqm' :)
declare function c:foo(){
"foo"
};
(: data/u.xqm:)
module namespace u="u";
declare variable $u:path:="somewhere";
Saxon does not raise an error
java -cp "%SAXON_HOME%/saxon9he-9.1.5.jar" net.sf.saxon.Query main.xq