XML technologies / DocBook / Modular documents / Partial inclusion with XPointer

(Excerpt from "DocBook-XML: Media-neutral and platform-independent publishing" by Thomas Schraitle)

Note: XPointer support
XML parser support XPointer only partially. Before using XPointer, check your XML parser’s support.

By default, the entire referenced XML file is included. What if you need only certain parts?

The W3C developed XPointer to solve this in combination with XInclude. XPointer is covered by four specifications; you need only some of them:

XPointer Framework (W3C Recommendation)

This specification defines the framework, the XML Pointer Language (XPointer). Additional XPointer schemes, listed below, extend it.

XPointer xmlns() (W3C Recommendation)

This XPointer scheme specifies how to define Namespaces. These namespaces allow element and attribute names to be used.

XPointer element() (W3C Recommendation)

The XPointer element() scheme provides a simplified way to address XML elements.

XPointer xpointer()

The XPointer xpointer() scheme addresses parts of XML documents. It builds on XPath and adds features such as extracting strings and addressing points and ranges.

To use XPointer in the xi:include element, add the attribute xpointer:

Example: XInclude with XPointer

<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" xpointer="..." href="foo.xml"/>

The ellipsis stands for content described in the following sections. An XML parser supporting XPointer evaluates it and returns a matching structure.

  

  

back to top