Database Reference
In-Depth Information
For the XSLT programmers among us who think this sounds familiar: you're right. In
XSLT, serialization is controlled likewise through the
xsl:output
element.
Controlling Serialization
There are a number of ways you can control serialization from within your XQuery
scripts:
option exist:serialize
You can control serialization by adding a
declare option exist:serialize
statement to the XQuery prolog. For instance:
declare
option
exist:serialize
"method=html media-type=text/html indent=no"
;
The contents of the
exist:serialize
option are a whitespace-separated list of
name/value pairs, as described inthe following section. You do not have to define
the
exist
namespace prefix. eXist automatically binds this to the appropriate
http://exist.sourceforge.net/NS/exist
namespace.
util:get-option
,
util:declare-option
These extension functions allow you to inspect and set the value of an XQuery
script option programmatically. For instance, setting the serialization options
can be done with:
util:declare-option
(
"exist:serialize"
,
"method=html media-type=text/html indent=no"
)
XQuery 3.0 serialization settings
eXist now also supports the standard XQuery 3.0 way of controlling serialization.
This is described in
“Serialization” on page 115
.
Serialization Options
This section will list all the serialization options that eXist supports.
General serialization options
The more general serialization options closely mimic the options of the same name
available on the XSLT
xsl:output
command:
method=xml|microxml|xhtml|html5|text|json
Sets the principal serialization method.
The
microxml
method produces MicroXML as opposed to full XML. You can
find out more about MicroXML from the
W3C MicroXML Community Group
.
Search WWH ::
Custom Search