XML technologies / DocBook / Customizing DocBook / DocBook 4 structure / Writing a customization file for DocBook 4

(Excerpt from "DocBook-XML: Medienneutrales und plattformunabhängiges Publizieren" by Thomas Schraitle)

A customization file is needed to modify DocBook 4 or combine it with another DTD. It may be complex or contain only a few lines. Its location depends on several factors:

Choose any filename. A general customization file looks like this:

Example: General structure of a DocBook 4 customization file

<!-- Parameter-Entities -->
<!-- Einfügen der DocBook-DTD -->
<!ENTITY % DocBookDTD PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd">
%DocBookDTD;
<!-- Umdefinieren von Elementen und Attributen -->

Line 1: Insert ENTITY declarations here: parameter entities set to IGNORE or extensions of a %local.*; entity.
Line 4: Load the DocBook 4.5 DTD through a parameter entity reference.
Line 5: Add new elements and attributes here.

This is the simplest approach. Later sections explain customization files in detail; this section introduces the concept.

Another simple case removes elements and attributes with on/off switches. This works only for simple elements with limited content models and no dependencies. A few lines in the DTD’s internal subset suffice:

Example: Simple customization in the DTD’s internal subset

<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd"
[
  <!-- Überschreiben Sie hier Entity-Deklarationen oder definieren Sie neue Elemente oder Attribute -->
]>
<book>...</book>

  

back to top