Database Reference
In-Depth Information
formatter for final processing. If your XSL-FO document doesn't contain any errors,
a PDF is produced.
Performing the final XSL-FO transformation is trivial. We assume here that the XSL-
FO document creation is already complete and that the final XSL-FO document is
available from somewhere in the database. The following example transforms this
document to PDF and displays it in your browser:
let
$
xsl-fo-document
as
document-node
()
:=
doc
(
'some-xsl-fo.xml'
)
let
$
media-type
as
xs:string
:=
'application/pdf'
return
response:stream-binary
(
xslfo:render
(
$
xsl-fo-document
,
$
media-type
,
()),
$
media-type
,
'output.pdf'
)
The
xslfo:render
function does the trick: it transforms the XSL-FO instructions
into a (binary,
xs:base64binary
) PDF document and returns this. This is picked up
by
response:stream-binary
, which sends it to your browser. Because the Internet
media type is set to
application/pdf
, it will (hopefully) show up as a nicely format‐
ted PDF document. There is an example in the accompanying source code (see
“Accompanying Source Code” on page 15
) that does exactly this.
The parameters for the
xslfo:render
function are:
$document as node()
The XSL-FO document to render.
$mime-type as xs:string
The requested output's Internet media type. In most cases this will be
applica
tion/pdf
. Please refer to your XSL-FO formatter's documentation to find out if
other Internet media types are supported also.
$parameters as node()
Parameters to pass to the formatter. The format, a
parameter
element with
param
children, is exactly the same as that used for passing parameters to an XSLT
transformation (see
“Passing XSLT Parameters” on page 241
). Recognized ren‐
dering parameters are
author
,
title
,
keywords
, and
dpi
.
$config-file as node()
(optional)
An optional formatter configuration file. Please refer to your XSL-FO formatter's
documentation for more information about this.
Search WWH ::
Custom Search