[xquery-talk] Modules and duplicate declarations

Ronald Bourret rpbourret at rpbourret.com
Fri Jul 20 22:39:41 PDT 2007


I am having trouble understanding how to import the same module in 
multiple places.

The test query requires modules A and B, and module A requires module B. 
Therefore, test imports A and B, and A imports B:

module namespace a = "a";
import module namespace b = "b" at "...";
declare variable $a:a1 := fn:concat("a", $b:b1);

module namespace b = "b";
declare variable $b:b1 := "b";

import module namespace a = "a" at "...";
import module namespace b = "b" at "...";
($a:a1, $b:b1)

Running test returns XQST0049, stating that $b:b1 was declared twice. If 
test doesn't import blib.xqy, it returns XPST0008, stating that prefix b 
has not been declared.

I don't understand the first error. The XQuery spec states that module 
imports are not transitive. That is, if A imports B and B imports C, C 
is not visible to A. Thus, $b:b1 should be visible to test only by 
directly importing blib.xqy and not by importing alib.xqy.

Is this a bug in the processor (Saxon 8.6.1) or am I misreading the spec?


-- Ron

More information about the talk mailing list