Reputation: 29739
I want to perform an XSLT 2.0 transformation by the use of command line executions. I heard that i could use the Saxon library by a shell command like:
java -jar sax.jar -input foo.xml -xsl foo.xsl -output bar.xml
Does anyone know how exactly I can achieve that goal?
By the way, i am not limited to Java. Any other shell solution is fine.
Upvotes: 17
Views: 14231
Reputation: 167436
The documentation of Saxon is online: http://www.saxonica.com/documentation/#!using-xsl/commandline. So you need:
java -jar saxon9he.jar -xsl:foo.xsl -s:foo.xml -o:bar.xml
Upvotes: 14
Reputation: 18584
Update: check solution 2 and 3 if your java is version 11 or later, where .internal.
are not available anymore.
I just wrote this bash script to use com.sun.org.apache.xalan.internal.xsltc.cmdline classes for transforming XML. Works with openjdk just fine. Not a solution for production use cases but handy for debugging.
P.S. took the idea from this blog
Upvotes: 3