Static base-uri for in-browser exported stylesheets.
Currently the export format contains
baseUri="path" attributes which are used to recover the static base URI at run time. These refer to the location of the defining stylesheet at compile time. In cases where the exported stylesheet is being run in browser under Saxon-JS, this is inappropriate, as usually the export is loaded via HTTP and far removed from its original location.
Context.fixed now has three additional properties which are set during initialisation:
staticBaseURI- which is the absolute URI of the export file loaded via the stylesheetLocation option. This is now used to recover 'stylesheet-relative' resources e.g. @select="doc('myResources.xml')"@, assuming any HTTP server URL resolution is configured suitably.
htmlURI- the absolute URI of the html document that invoked Saxon-JS
In execution outside the browser, static base URI is still recovered from attributes in the export file.
Changes committed to the Saxon-JS code.
#1 Updated by Michael Kay over 2 years ago
- Status changed from Resolved to In Progress
Leaving open because I think there are some wider issues.
I have changed the ExpressionPresenter to use a configuration option FeatureKeys.EXPORT_BASE_URI, if set false, the static base URI is not written to the export file. The option is set false automatically when target:JS is used.
I have also changed it to output the "module" attribute (used when reporting dynamic errors) in truncated form if EXPORT_BASE_URI is false. Only the last part of the path is output.
#3 Updated by Debbie Lockett about 2 years ago
Further commits made to the Saxon-JS code, and 9.8 code.
From 9.8, it is possible to control whether an SEF is "relocatable". If an SEF is relocatable, this means it contains no local base URI information (in attributes such as @baseUri). This control is independent to setting the target edition (for instance to "JS"). The attribute @relocatable (with value "true"or "false") is added to the package element of an SEF to indicate this setting.
The configuration option FeatureKeys.EXPORT_BASE_URI has been removed, and replaced by the property "relocatable" (in CompilerInfo, ExpressionPresenter, and PackageData).
When running the XsltTestSuiteDriverJS (in Nashorn) this can be controlled using the option -relocatable:on|off.
When running outside the browser, if relocatable is true, then the stylesheetFileName is used for the Context.fixed.staticBaseUri.
Please register to edit this issue