XML technologies / DocBook / Modular documents / Partial inclusion with XPointer / Including content through self-reference
(Excerpt from "DocBook-XML: Media-neutral and platform-independent publishing" by Thomas Schraitle)
Sometimes you need to reference information in elements located in the same file rather than another file. Here too, you can retrieve the information with an XPointer expression:
Example: Inclusion with an XPointer expression without href attributes
DocBook 4
<chapter>
<chapterinfo>
<author>
<firstname>Tux</firstname>
<surname>Penguin</surname>
</author>
</chapterinfo>
...
<para>Der Autor dieses Kapitels ist <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" xpointer="xpointer(/chapter/chapterinfo/author)"/>.</para>
</chapter>DocBook 5
<chapter xmlns="http://docbook.org/ns/docbook">
<info>
<author>
<personname>
<firstname>Tux</firstname>
<surname>Penguin</surname>
</personname>
</author>
</info>
...
<para>Der Autor dieses Kapitels ist <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(/db:chapter/db:info/db:author)"/>.
</para>
</chapter>Note that, for the same file, you need no href attribute.
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