Doing XSL and FOP transformations on the commandline using Saxon and Apache FOP
# java -jar saxon9.jar -s:<inputfilename> -xsl:<xsl filename> -o:<outputfilename> Classpath must include all jars necessary for FOP:
# for name in fop-1.1/lib/*.jar; do export CLASSPATH=$name:$CLASSPATH; done; Use output from another transformation, i.e. an FO-File:
# java -classpath $CLASSPATH org.apache.fop.cli.Main -fo <fo filename> -pdf <pdf outputfilename> Use internal transformation mechanism, i.e. input is xml, xsl file transforms to fo:
# java -classpath $CLASSPATH org.apache.fop.cli.Main -xml <xml input filename> -xsl <xsl filename> -pdf <pdf outputfilename> A complete step from XML to PDF might look like this, using input.xml, transform2fo.xsl and output.pdf als filenames: Using Saxon:
# java -jar saxon9.jar -s:input.xml -xsl:transform2fo.xsl -o:intermediate.fo
# java -classpath $CLASSPATH org.apache.fop.cli.Main -fo intermediate.fo -pdf output.pdf Using only Apache FOP:
# java -classpath $CLASSPATH org.apache.fop.cli.Main -xml input.xml -xsl transform2fo.xsl -pdf output.pdf
Links:
Apache FOP Distribution download (http://)
Apache FOP commandline interface (http://)
Saon commandline interface (http://saxonica.com)
Apache FOP Distribution download (http://)
Apache FOP commandline interface (http://)
Saon commandline interface (http://saxonica.com)