-
Notifications
You must be signed in to change notification settings - Fork 2
Alternative XSLT Engine
Q: I don't have xsltproc
on my system. Can I use a different XSL transformer?
A: Yes, it requires some additional configuration. We'll demonstrate it below with the free Apache Xalan XSL Engine (https://xalan.apache.org). (NOTE: Xalan seems to have a bug when referencing an external document multiple times, so libxslt-based transformers are recommended right now).
The PP projects expect that the engine be called using the xsltproc
calling convension namely
command [--stringparam paramname1 paramvalue1 [--stringparam paramname2 ... ]] -o outputpath xslpath inputpath
but other engines are called with different calling conventions, so if you want to use those, you'll have to wrap them appropriately. Currently this is far from trivial.
For example, Xalan(Java) uses the following calling convention:
java [-param paramname1 paramvalue1 [ -param _paramname...]] -xsl xslpath -in input -out output
Thus the Xalan wrapper might look something like the following:
#!/bin/sh
# xalan-transform
while [ "$#" -gt 2 ]; do
if [ "$1" == "--stringparam" ];then
parametizer="-param $2 $3"
shift
shift
elif [ "$1" == "-o" ]; then
OUT=$2
shift
fi
shift
done
java -cp /opt/xalan/xalan-j_2_7_2/xalan.jar:/opt/xalan/xalan-j_2_7_2/xercesImpl.jar org.apache.xalan.xslt.Process -param debug p $parametizer -xsl $1 -in $2 -out $OUT
You'd then put this wrapper in your path and set the XSL_EXE variable to point to the wrapper (either in an environment variable or in the makefile).
Obviously you'd still need a make
utility AND, not so obvious, you still need some sort of Unix shell emulation as the paths are all formatted with Unix slashes('/').