Database Reference
In-Depth Information
Checking for and invoking an XSLT stylesheet by processing instruction is enabled
by default. You can, however, disable it with serialization options; see “Post-
processing serialization options” on page 120 .
Stylesheet Details
Here are some final details about using XSLT from within eXist:
• If you get a puzzling Java NullPointerException when trying to transform
something using a URI for the stylesheet, it probably means that the URI was
incorrect.This rather unspecific error message makes it hard to find out why the
code isn't working. A common mistake here is to forget to start the URI with
xmldb:exist:// when you want to specify a stylesheet in the database!
• The serialization options set in the XSLT stylesheet itself (with xsl:output ) will
not be used.
xsl:include and xsl:import work as expected. Relative filenames are resolved
against the location of the stylesheet.
• The XPath doc function in a stylesheet works as expected: it loads a document.
Relative paths are resolved against the location of the stylesheet (not the location
of the calling XQuery file). Like in XQuery, doc silently returns an empty
sequence, () , when the referenced document is not an XML file.
• The collection function does not behave as you would expect: it does not
return any direct information about the collections in the database. It can, how‐
ever, be used as Saxon intended it. For more information about this, please refer
to the Saxon documentation .
• You can use the XSLT xsl:result-document instruction to create files on the fil‐
esystem only; writing to the database (with an XMLDB URI) results in an error.
Relative paths are resolved against $EXIST_HOME (so <xsl:result-document
href="test.xml"> will result in a file $EXIST_HOME/test.xml , which is proba‐
bly not where you want an output file to be written).
XInclude
By default, eXist performs XInclude processing during the serialization phase. In a
nutshell, this means that xi:include elements are replaced with what they refer to
(the namespace prefix xi must be bound to the namespace http://www.w3.org/
2001/XInclude ). XInclude is an official W3C standard .
XInclude is primarily intended for reusing XML or XHTML code fragments. There‐
fore, a use case for XInclude is an application that outputs pages with a fixed menu
Search WWH ::




Custom Search