XML technologies / DocBook / Modular documents / Adding XIncludes to DocBook 4.x
(Excerpt from "DocBook-XML: Medienneutrales und plattformunabhängiges Publizieren" by Thomas Schraitle)
This section is only needed if you want to validate a DocBook 4 document containing XIncludes without resolving the XInclude elements to their referenced resources.
Version 4.x of the DocBookDTD does not recognize XIncludes. Your XML editor therefore cannot offer these elements when you write a DocBook document. Fortunately, allowing them at certain positions takes little effort. Proceed as follows:
First create the file
xinclude.modwith the following content:
<!ENTITY % xmlnsxi 'xmlns:xi CDATA #FIXED "http://www.w3.org/2001/XInclude"'>
<!ELEMENT xi:include (xi:fallback?) >
<!ATTLIST xi:include
%xmlnsxi;
href CDATA #IMPLIED
parse (text|xml) "xml"
xpointer CDATA #IMPLIED
encoding CDATA #IMPLIED
accept CDATA #IMPLIED
accept-charset CDATA #IMPLIED
accept-language CDATA #IMPLIED
>
<!ELEMENT xi:fallback ANY >
<!ATTLIST xi:fallback %xmlnsxi; >Add the following code to the file in which you want to allow XInclude elements:
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd"
[
<!ENTITY % xinclude SYSTEM "xinclude.mod">
%xinclude;
<!ENTITY % local.chapter.class "| xi:include">
<!ENTITY % local.section.class "| xi:include">
<!ENTITY % local.info.class "| xi:include">
<!-- Folgende Zeile nur für DocBook 4.2 und früher auskommentieren -->
<!-- <!ENTITY % local.common.attrib "xml:base CDATA #IMPLIED"> -->
]>
<book>...</book>Uncomment the entity declaration
%local.common.attrib;in the preceding step if you use DocBook 4.2 or earlier.Apply the change from step 2 to every file in which you want to use XInclude elements.
These changes let you validate an XML file without having to resolve XInclude elements.
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