XML technologies / DocBook / Modular documents / Partial inclusion with XPointer / Including using an XPath
(Excerpt from "DocBook-XML: Media-neutral and platform-independent publishing" by Thomas Schraitle)
Although an XML document is entered as a text file, the XML parser builds a tree in memory when reading it. A particular element in this tree can be identified by a path, called an "XPath". For example, if a DocBook 4 document starts with a chapter containing a section with a paragraph, the path to that paragraph is:
/chapter/section/para This creates an XPath expression. The XPointer specification requires this expression to be enclosed in xpointer(). The following lines are therefore valid XPointers:
xpointer(/chapter/section)
xpointer(/chapter/section[2])
xpointer(/chapter/title)
xpointer(id('foo')) Starting from chapter, these XPointer expressions select different items: line 1 selects all section elements; line 2 selects only the second section, line 3 selects the element title of chapter, and line 4 selects the element whose ID value is foo.
Copyright © 2009 Millin Verlag
You may print the online version for your private use.
Otherwise, this chapter from "DocBook-XML: Medienneutrales und plattformunabhängiges Publizieren" is subject to the same provisions as the printed edition: the work, including all its parts, is protected by copyright. All rights are reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
Millin Verlag, Siebengebirgsring 36, 53797 Lohmar, info(at)millin.de
back to top