Database Reference
In-Depth Information
and navigation bar: you can insert the XHTML code for these parts using XInclude.
However, in eXist more complicated scenarios are also possible, like including the
output of XQuery scripts, or partial documents.
A first simple XInclude example can be found in “Hello XInclude” on page 35 .
XInclude processing is switched on by default. If you want to turn it off, you can do
so by using serialization options; see “Post-processing serialization options” on page
120 .
eXist's implementation of the XInclude standard is not complete. Its limitations are:
• You can't use it to include raw text. Only XML is supported.
• XPointers are restricted to XPath. Additional features, like points and ranges, are
not supported.
Including Documents
Including a document is easy—just add a reference to it in the href attribute, as in
the following examples:
<xi:include href= "includethisxml.xml" />
<xi:include href= "file:///file/from/filesystem.xml" />
<xi:include href= "http://somewhere.com/xmlfeed" />
If you don't include a scheme (like http:// or file:// ), the document is included
using the same scheme as the master document (either database or filesystem). Rela‐
tive paths are resolved from the location of the master document.
You can limit the output of the include by using an xpointer attribute holding a
limited XPointer expression . eXist supports two constructions:
Node identifier
If you only specify the identifier of a node, the output will be limited to that
node. An identifier can be set by an xml:id attribute or an attribute that is
marked as type ID by an attached DTD. For instance, if we have the document:
<Lines>
<Line xml:id= "L1" > Line 1 </Line>
<Line xml:id= "L2" > Line 2 </Line>
</Lines>
Specifying the XInclude as <xi:include href="..." xpointer="L1"/> (assum‐
ing the href is correct) will only include the first Line element.
XPath
The other construction supported is passing an XPath expression with the so-
called xpointer scheme. Here are some examples:
Search WWH ::




Custom Search