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".
generator
($output-format as xs:string, $xsl-fo-document as node()) as xs:base64Binary
The generator function takes an XSL-FO document as input and generates output in the format given as input. |
declare function xsl-fo:generator($output-format as xs:string, $xsl-fo-document as node()) as xs:base64Binary
On a Mac OS X computer, it should be sufficient to install Apache FOP via Mac Ports.
On Ubuntu it should be sufficient to install the fop packages via apt-get.
On Windows, the classpath needs to be set manually using generator#3.
This function tries to find the jar files via environment variables. The user can set the variable FOP_HOME to the root directory of an Apache FOP distribution. If you have all JAR files in the same directory, you can set the environment variable FOP_LIB_DIR to this directory.
$xsl-fo:AFP as xs:string
$xsl-fo:EPS as xs:string
$xsl-fo:PCL as xs:string
$xsl-fo:PDF as xs:string
$xsl-fo:PLAIN_TEXT as xs:string
$xsl-fo:PNG as xs:string
$xsl-fo:POSTSCRIPT as xs:string
$xsl-fo:RTF as xs:string
$xsl-fo:TIFF as xs:string