How to resolve xsl:include relative URIs against stylesheet's location instead of the current working directory?
Replies (2)
Please register to reply
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?
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.
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! :-)
Please register to reply