Thanks, I have logged this here:

https://saxonica.plan.io/issues/2111

Michael Kay

Saxonica

 

> When the XQUERY_VERSION configuration property is set before installing a
> module URI resolver in the configuration, that URI resolver is not
> propagated
> to XQueryCompiler instances based on that configuration.
>
> This may not be the intended behaviour. Or is it?
>
> Some sample code is shown below. It will complain about the module
> missing,
> but can be fixed by omitting setConfigurationProperty, or by explicitly
> setting
> the module URI resolver in the XQueryCompiler (e.g. by getting from the
> configuration).
>
> Best regards,
> Gunther
>
>
> public class ImportModule {
> public static void main(String[] args) throws Exception {
> final Configuration configuration = new Configuration();
>
> configuration.setConfigurationProperty(FeatureKeys.XQUERY_VERSION,
> "1.0");
>
> configuration.setModuleURIResolver(new ModuleURIResolver() {
> @Override
> public StreamSource[] resolve(String moduleURI, String baseURI,
> String[] locations) throws XPathException {
> StringReader reader = new StringReader("module namespace
> x='x'; declare variable $x:x := 'x';");
> StreamSource module = new StreamSource(reader);
> module.setSystemId(moduleURI);
> return new StreamSource[] {module};
> }
> });
>
> Processor processor = new Processor(configuration);
> XQueryCompiler xqueryCompiler = processor.newXQueryCompiler();
> xqueryCompiler.setBaseURI(new File(".").toURI());
>
> XQueryExecutable executable = xqueryCompiler.compile("import
> module namespace x='x'; $x:x\n");
> executable.load().run(new Serializer(System.out));
> }
> }
>
>
>
> Software AG – Sitz/Registered office: Uhlandstraße 12, 64297 Darmstadt,
> Germany – Registergericht/Commercial register: Darmstadt HRB 1562 -
> Vorstand/Management Board: Karl-Heinz Streibich (Vorsitzender/Chairman),
> Dr. Wolfram Jost, Arnd Zinnhardt; - Aufsichtsratsvorsitzender/Chairman of
> the Supervisory Board: Dr. Andreas Bereczky - http://www.softwareag.com
> ------------------------------------------------------------------------------
> Want fast and easy access to all the code in your enterprise? Index and
> search up to 200,000 lines of code with a free copy of Black Duck
> Code Sight - the same software that powers the world's largest code
> search on Ohloh, the Black Duck Open Hub! Try it now.
> http://p.sf.net/sfu/bds_______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/
> saxon-help@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/saxon-help