Project

Profile

Help

Bug #4471

Base URI of configuration file supplied to fn:transform()

Added by Michael Kay over 1 year ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
XSLT 3.0 packages
Sprint/Milestone:
-
Start date:
2020-03-02
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
9.9, trunk
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

Description

From saxon-help mailing list:

When I have config.xml like this

  <configuration xmlns="http://saxon.sf.net/ns/configuration">
     <xsltPackages>
        <package name="http://example.org/package.xsl" sourceLocation="../package/package.xsl"
           version="1.0" />
     </xsltPackages>
  </configuration>

and provide it to fn:transform() like this

  <xsl:variable name="config" select="doc('../config/config.xml')" />
  <xsl:variable as="map(*)" name="options"
     select="
        map {
           'stylesheet-location': '../use-package/use-package.xsl',
           'initial-template': xs:QName('xsl:initial-template'),
           'vendor-options':
              map {
                 QName('http://saxon.sf.net/', 'configuration'): $config
              }
        }" />
  <xsl:sequence select="transform($options)?output" />

then @sourceLocation in the config is not resolved as relative to config.xml. (but to the current directory? it seems)

Could this be improved? Otherwise I'll have to fix up every URI in the config dynamically...

History

#1 Updated by Michael Kay over 1 year ago

The code to read configuration files accepts the input as a SAX ContentHandler in the form of push events, and relies on the SAX event supplier (normally an XMLReader) to supply location information including the base URI. For fn:transform the configuration file is an in-memory document tree, we're stripping down the NodeInfo into a sequence of SAX events using the ContentHandlerProxy class, and I don't believe this is calling ContentHandler.setDocumentLocator, which means that the base URI is unknown.

#2 Updated by Michael Kay over 1 year ago

Test case xslt30-extra/transform/transform-100 created.

#3 Updated by Michael Kay over 1 year ago

  • Status changed from New to Resolved
  • Applies to branch 9.9, trunk added

Fixed.

#4 Updated by O'Neil Delpratt over 1 year ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 9.9.1.7 added

Patch applied in the 9.9.1.7 maintenance release.

Please register to edit this issue

Also available in: Atom PDF