Test XSLT using Java and a bash script

I was recently asked to implement an XSLT Stylesheet to be used within a NetIQ IDM Connector. Rather than start up my CentOS Virtual Machine (VM), I decided to take a different approach: test the XSLT from the command line. Fortunately, it’s not very difficult to do this by using the built in XSLT processor in Java.

Using java com.sun.org.apache.xalan.internal.xsltc.cmdline with Compile and Transform, one can easily convert an XML file from one format to another format using an XSLT Stylesheet!

Shown below is a bash script that allows one to test on a Linux machine!