XML technologies / DocBook / Customizing DocBook / DocBook 5 structure / Differences from customizations of the DocBook-DTD
(Excerpt from "DocBook-XML: Medienneutrales und plattformunabhängiges Publizieren" by Thomas Schraitle)
DocBook was first defined as an SGML DTD and later as an XML DTD. Both variants have limitations, which is why Norman Walsh chose RELAX NG for DocBook’s next major version.
Unlike the DocBook DTD, DocBook 5 is distributed as a single file, although its schema is developed modularly. (The Subversion repository contains these modules.) Unlike the DTD version, the RELAX NG version uses no parameter entities but rather definition patterns. For example, the element example is defined in the DocBook 4 DTD as follows:
<!ENTITY % local.example.attrib "">
<!ENTITY % example.role.attrib "%role.attrib;">
<!-- ... -->
<!ELEMENT example %ho; (blockinfo?, (%formalobject.title.content;),
(%example.mix;)+)
%formal.exclusion;>The parameter entity %local.example.attrib; lets you extend the attributes of example. DocBook 5 does not need these local parameter entities: customize a RELAX NG schema by overriding or extending definition patterns. In version 5, all names begin with the prefix db followed by a dot. For comparison, the preceding element declaration in RELAX NG compact syntax is:
db.example =
# Schematron-Regeln ausgeblendet
element example {
db.example.attlist,
db.example.info, db.all.blocks+, db.caption?
}In XML syntax, this becomes:
<define name="db.example">
<!-- Schematron-Regeln ausgeblendet -->
<element name="example">
<ref name="db.example.attlist"/>
<ref name="db.example.info"/>
<oneOrMore>
<ref name="db.all.blocks"/>
</oneOrMore>
<optional>
<ref name="db.caption"/>
</optional>
</element>
</define>Unlike a DTD, RELAX NG specifies content models and attributes together. A DTD requires a separate declaration using ATTLIST.
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