[<< wikibooks] XQuery/XSL-FO SVG
== Motivation ==
You want to convert XML into PDF and embed SVG graphics in the output.


== Method ==
eXist since version 2 supports placing svg in fop rendered pdf out of the box, the only step being to activate the XSLFO module before building the source:
echo "include.module.xslfo = true" > $EXIST_HOME/extensions/local.build.properties
Beware: On headless *nix systems, make sure that there is no DISPLAY environment variable set, when eXist-db is started, otherwise the apache batik svg renderer may throw an exception.


== Sample XQuery ==
Highlights of the xquery: The FO is created from an xsl transform: I know, this could be done with xquery, but I can reuse the xsl in other places. The document is found through a search. The xsl stylesheet resides in "views", as the pdf.xq does. I create lots of variables, but its better that way. Filename deduced from request. There may be errors, as I stripped down working code! It may be overly complicated due to my ignorance of xquery features. I think you will find your way. Application directory laid out as advised in the XRX wiki.

Another, possibly higher performance, way to source the svgfile by the xmldb:exist qualifier:


== Highlights of the XSL: ==