eerohele / saxon-gradle

A Gradle plugin for running XSLT transformations with Saxon
MIT License
16 stars 6 forks source link

Handle xml:base when parsing XSLT #21

Open ndw opened 3 years ago

ndw commented 3 years ago

I don't know if this is worth addressing, given that it's probably unlikely in practice, but it occurs to me that the code which parses XSLT looking for xsl:include and xsl:import elements isn't currently sensitive to xml:base changes.

Consider:

<xsl:stylesheet xml:base="/path/to/somewhere/">
   <xsl:include href="foo.xsl"/>
   ...

The included stylesheet is /path/to/somewhere/foo.xsl irrespective of what the URI of the stylesheet is.

eerohele commented 3 years ago

Thanks for the report! Yeah, it's probably not a critical thing, but shouldn't be too difficult to implement, either, I suppose.

PR welcome, or I can take a look when I get the time.

ndw commented 3 years ago

Attempting to do this in Groovy (for another plugin) was the point at which I gave up on XmlSlurper. I switched to using the Saxon APIs. If you'd be interested in a patch that does that much violence to the plugin, I can probably put it together.