eerohele / saxon-gradle

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

Unresolved dtd file from xml source file #7

Closed ultraon closed 6 years ago

ultraon commented 7 years ago

Hello, thank you for this plugin. I bumped with issue when i try to execute xsl transformation from xml to text/csv file and xml file contains declaration with reference to some local file "report.dtd" (Jacoco xml file) the transformation is always failed because there is no such a dtd file. I found way to resolve it by declaring dummy.dtd (empty file), make reference to them from catalog.xml, and put this setting to the xslt gradle block ("catalog" parameter) and it works. See this link http://www.scriptorium.com/2009/09/ignoring-doctype-in-xsl-transforms-using-saxon-9b/ Also to use XSLT 2.0 it needs to declare additional classpath in the buildscript.dependencies block: " classpath 'net.sf.saxon:Saxon-HE:9.7.0-11'"

ultraon commented 7 years ago

Another solutions with different params didn't help me, and it would be great to make some comment in current github project description for that situation.

eerohele commented 7 years ago

Glad to hear you find it useful.

I'll consider adding a note about the DTD issue in the README, although it's not really specific to this plugin. You'd have the same problem if you tried running Saxon directly.

Also to use XSLT 2.0 it needs to declare additional classpath in the buildscript.dependencies block: " classpath 'net.sf.saxon:Saxon-HE:9.7.0-11'"

Can you elaborate what you mean by this? You shouldn't need to do that to execute XSLT2+ transformations with this plugin. I certainly never have.

It might be that if you reference another library that depends on a really old version of Saxon, Gradle tries to pick up that version from the classpath instead of the one that this plugin depends on. That's the first thing I can think of, anyway.

It would definitely be good to in some way be able to control the specific Saxon version to use by supplying a configuration parameter to the plugin. I'll try to think about how to best implement that.

eerohele commented 6 years ago

It would definitely be good to in some way be able to control the specific Saxon version to use by supplying a configuration parameter to the plugin. I'll try to think about how to best implement that.

Since Saxon is a compile-time dependency, I don't see any way to do that.

I'll close this issue. If you experience any further problems, please don't hesitate to either comment here or open a new issue.