Project

Profile

Help

default base-uri for a module in 8.7.1

Added by Anonymous almost 18 years ago

Legacy ID: #3747175 Legacy Poster: marcvc (marcvc)

Michael, We notice a behavioral difference between Saxon 8.7 and 8.7.1. The base-uri is set through the API, and in 8.7 this is used as default (overwritable through the prolog) for both the main module and any imported modules. With Saxon 8.7.1 the base-uri for the imported modules seems to default to the physical location of the file containing the module query text (for simplicity assuming the default module uri resolver is in charge). Here is a repro. Query: declare base-uri "file:///C:/test"; import module namespace foo="http://www.foo.com" at "file:///C:/module.xq"; foo:test() Module: module namespace foo = "http://www.foo.com"; declare function foo:test() { doc("test.xml") }; test.xml is located in the directory C:/test With Saxon 8.7 we get as expected the content of test.xml With Saxon 8.7.1 the following error is returned: Error on line 4 of file:/C:/module.xq: FODC0005: java.io.FileNotFoundException: C:\test.xml (The system cannot find the file specified) I think that a recent change in XQueryFunction#compile is causing the difference? Thanks, Marc


Replies (1)

RE: default base-uri for a module in 8.7.1 - Added by Anonymous almost 18 years ago

Legacy ID: #3774068 Legacy Poster: Michael Kay (mhkay)

Apologies for the delay in responding. For some reason SourceForge has stopped sending me notifications of forum posts. I think this change was made as part of the fix for the problem that the ModuleURIResolver was being used only at the top level. It seems correct to use the physical file location, overridden by the base URI from the prolog if specified. If there's a ModuleURIResolver, then I think that can also determine the base URI by setting the SystemID property in the returned StreamSource. I don't think it makes sense to use the value supplied using setBaseURI() in the API for all modules, since there's only one value. I would take guidance here from XQJ, but unfortunately XQJ doesn't seem to allow the base URI to be set by the calling application even for the main module.

    (1-1/1)

    Please register to reply