This module converts XSL-FO documents
to various formats such as PDF, EPS, PCL, AFP, Text, PNG, Postscript, RTF, and TIFF.
For instance, the following example converts a simple XSL-FO document to PDF:
import module namespace fop = "http://zorba.io/modules/xsl-fo";
import module namespace file = "http://expath.org/ns/file";
declare namespace fo = "http://www.w3.org/1999/XSL/Format";
let $xsl-fo := <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="my-page">
<fo:region-body margin="1in"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="my-page">
<fo:flow flow-name="xsl-region-body">
<fo:block>Hello, world!</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
let $pdf := fop:generator($fop:PDF, $xsl-fo)
return file:write-binary("simple.pdf", $pdf)
This module uses Apache-FOP to generate content from an XSL-FO document.
See the Apache FOP documentation for further information.
Note for Windows users: On Windows, this module won't work out of the box, since
this module uses Java. But the Java VM dll is not in the system path by default. To make
this module work, you need to add the directory where the jvm.dll is located to the
system path. This dll is located at JRE_DIR\bin\client. On a standard installation, this would
be something a path like "C:\Program Files\Java\jre6\bin\client".