Misleading error msg (when imported module not found)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Misleading error msg (when imported module not found)

Hans-Juergen Rennau
Dear Saxon team,

I observed a misleading error message that you may care to correct, occasionally.

Scenario: module1 has an erroneous import declaration so that it cannot find the imported module module2.
Observed message:

Error on line 4 column 68 of demo-module1.xq:
  XQST0034 XQuery static error near #...ng) as node() { i:bar($uri) };#:
    Duplicate definition of function m:foo (see line 5 in
  file:/c:/projects/infospace/pcol/demo-module2.xq)
Error on line 2 column 1 of demo-module0.xq:
  XQST0034: Static errors were reported in the imported library module
Static error(s) in query

This is misleading, as there is only one function "foo" - see below for complete code. The real error is that the import hint cannot be resolved.

Kind regards,
Hans-Jürgen

PS: Note that the import hint in demo-module1.xq is wrong because of the base uri declaration. It should be "tt/demo-module2.xq", rather than "demo-module2.xq". (After correction, the program works fine.) The only problem is the misleading error message.

Call:
xqueryx demo-module0.xq uri=dummy.xml

somewhere/demo-module0.xq:
========================
import module namespace m="http://www.ttools.org/xquery-functions" at "tmp/demo-module1.xq";
declare variable $uri external;
m:foo($uri)

somewhere/tt/demo-module1.xq:
=========================
module namespace m="http://www.ttools.org/xquery-functions";
import module namespace i="http://www.ttools.org/xquery-functions" at "demo-module2.xq";
declare base-uri "..";
declare function m:foo($uri as xs:string) {i:bar($uri)};

somewhere/tt/demo-module2.xq:
=========================
module namespace m="http://www.ttools.org/xquery-functions";
declare base-uri "..";
declare function m:bar($uri as xs:string) {doc($uri)};


------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help