Project

Profile

Help

How to resolve xsl:include relative URIs against stylesheet's location instead of the current working directory?

Added by Markus Karg over 11 years ago

I noticed that SAXON resolves relative URIs of xsl:include against the current working directory of the current process. How can I convince SAXON to instead resolve relative URIs against the location where the stylesheet is taken from?


Replies (2)

RE: How to resolve xsl:include relative URIs against stylesheet's location instead of the current working directory? - Added by Michael Kay over 11 years ago

Saxon will always resolve relative URIs against the stylesheet location if known. It will only use the current working directory if the stylesheet location is unknown.

The most common reason for an unknown location is that you supplied the stylesheet as a StreamSource without setting the systemId property.

RE: How to resolve xsl:include relative URIs against stylesheet's location instead of the current working directory? - Added by Markus Karg over 11 years ago

Michael, thank you for your kind help! I checked your answers to the same beginner's question in other places and now understand that obviously SAXON cannot guess a base URI other than the current working directory when XSL is a STREAM... Shame on me. I actually solved it by providing a system ID to the StreamSource constructor (xslUrl.toExternalForm()), which works pretty well! :-)

    (1-2/2)

    Please register to reply