Cordial thanks,Christian! Hans-Jürgen
Christian Grün christian.gruen@gmail.com schrieb am 14:13 Sonntag, 18.Januar 2015:
Hi Hans-Jürgen,
the parsing problem has been fixed.
Christian
On Sat, Jan 17, 2015 at 5:09 PM, Christian Grün christian.gruen@gmail.com wrote:
Hi Hans-Jürgen,
Your query will work if you move the base-uri declaration before the module imports. I agree this is not compliant with the spec. The reason is that we import a module as soon as the "import module" statement is found. We'll probably need to parse the full query prolog before starting the import. As I cannot foresee what other consequences this will have, I have added a new GitHub issue [1].
All the best, Christian
[1] https://github.com/BaseXdb/basex/issues/1058
On Sat, Jan 17, 2015 at 12:20 AM, Hans-Juergen Rennau hrennau@yahoo.de wrote:
Dear BaseX team,
I think that the resolving of module import hints does not work properly if the importing module has a relative base URI declaration.
In the example below, module1 and module2 both are located in a directory "tt". As module 1 has a base URI declaration setting the base URI to "..", its import of module2 should require the following import hint: "tt/module2.xq", rather than "module2.xq". However, this produces an error; the error is not thrown when the import hint is erroneously set to "module"
- which is, of course, also wrong behaviour.
Compare: http://www.w3.org/TR/xquery-30/#id-base-uri-decl
Cheers, Hans-Jürgen
PS call: basex -b uri=dummy.xml main.xq => [XQST0059] Could not retrieve module 'C:/projects/infospace/pcol/tmp/tt/module2.xq'.
main.xq:
import module namespace m="http://www.ttools.org/xquery-functions" at "tmp/module1.xq"; declare variable $uri external; m:foo($uri)
module1.xq:
module namespace m="http://www.ttools.org/xquery-functions"; import module namespace i="http://www.ttools.org/xquery-functions" at "tt/module2.xq"; declare base-uri ".."; declare function m:foo($uri as xs:string) {i:bar($uri)};
module2.xq:
module namespace m="http://www.ttools.org/xquery-functions"; declare base-uri ".."; declare function m:bar($uri as xs:string) {doc($uri)};