I just found out that the problem is on my end in this issue. The inport of module fails because that particular URL pattern (.wl)has  a security contraint on our application server requring the user to be authenticated. Hence,  the failure. All other module imports  are able to go through because those URLs do not contain patterns with any contstraints.
Thank you.
 Dear Mr. Kay,
I just reconfirmed that the library module contents are the same in all the cases. The
error messages in all the listed scenarios are not different.
The library module contains a very simple function with no parameters and one line of
erroneous code (written deliberately) so that when accessed, my JUnit test can display the
error message and confirm that it is able to access the function and in turn, reference the
library module successfully.
Library Module Contents:
module namespace md1 = "xxx"; declare function md1:f(){ $doc};
Main Module contents are in my very first mail that reports the problem(below).


From: Michael Kay [mailto:support@sa...]
Sent: Wednesday, October 05, 2005 5:51 PM
To: Premal Desai
Subject: RE: Cannot import library module using URL

Firstly, could you please note that the correct way to post problems on Saxon-B is the
saxon-help list or forum at sourceforge. This enables other users to contribute to the
solution and to have access to the responses, and it also helps me track the history.
The error message you are getting suggests strongly that the module has been successfully
fetched via the URI given, but that its syntax is incorrect for a library module. A library
module must start with the declaration "module namespace ...", and Saxon is saying that it
did not find this syntax but instead found <element>. What is actually in the module?
I know this explanation doesn't match your claim that it worked when the module was
accessed using a different URI, but the syntax error message is very explicit. If it had
failed to fetch the module you would get a quite different message, as you could verify by
putting in a bad URI. Perhaps it wasn't actually the same module?
Michael Kay


From: Premal Desai [mailto:premal.desai@we...]
Sent: 05 October 2005 22:12
To: support@sa...
Subject: [Norton AntiSpam] Cannot import library module using URL

I have hit the wall with this problem -
I have a main module that is unable to import  a library module because of the URL I am
supplying  in the module import statement. As a result, I cannot execute my function that's
referenced. My import module statement is as:
import module namespace m1 = "xxx" at
This URL, when referenced in the browser,  returns the library module as text (as
expected). However, when I run my JUnit test to compile the above XQuery, I get the
following error from SAXON8.5;

Error on line 4 column 1 of

XPST0003: XQuery syntax error in #
expected "module namespace", found "<element>"

Can you please suggest/advise on what I can try to get my main module to import the library
module using the above url? It is important that we access it this way. Please note that I
have tried out the following:
1. Instead of having the library module returned from the web service (in the above url), I
simply stored it in a text file and accessed it as via URL. That was imported successfully
in the main module
import module namespace m1 = "xxx" at
Status: This Works
2. Instead of having the library module returned from the web service (in the above url), I
simply stored it in a text file and accessed it as via file URL. That was imported
successfully in the main module 
import module namespace m1 = "xxx" at "file:///C:/weblayers-center/xquery-lib/test.xq";
Status: This Works

3. I also tried escaping my URL. But that does not work either. Modified my url to:
import module namespace m1 = "xxx" at

Status: That does not work. Got the same error message from Saxon as shown above.
Also note that I am using open source Saxon 851.
Any help will be appreciated.
Thank You.


Yahoo! for Good
  Click here to donate to the Hurricane Katrina relief effort.

Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around