XML technologies / DocBook / Customizing DocBook / Removing elements / Removing section elements
(Excerpt from "DocBook-XML: Media-neutral and platform-independent publishing" by Thomas Schraitle)
A common requirement is to limit section nesting, for example allowing authors to nest sections only down to sect4.
Customizing DocBook 4
For DocBook 4, proceed as follows:
Procedure: Limiting section elements to sect4 for DocBook 4
Disabling
%sect4.module;and%sect5.module;
Add these lines to your customization file:
<!ENTITY % sect4.element "IGNORE">
<!ENTITY % sect5.module "IGNORE">These two lines disable the desired
sect5and redefinesect4without asect5.
Loading the DocBook DTD
Add these lines to your customization file to load the DocBook DTD:
<!ENTITY % DocBookDTD PUBLIC
"-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.docbook.org/xml/4.5/docbookx.dtd">
%DocBookDTD;Redefining
sect4
Insert the following line fromdbhierx.mod, but omitsect5:
<!ELEMENT sect4 %ho; (sect4info?,
(%sect.title.content;), (%nav.class;)*,
(((%divcomponent.mix;)+,
((%refentry.class;)* | simplesect*))
| (%refentry.class;)+ | simplesect+), (%nav.class;)*)>Using the customization file
Use the customization file instead of the original DocBook file (see Validating with a DocBook 4 customization file).
Customizing DocBook 5
In DocBook 5, the procedure is as straightforward as in previous sections. Add a notAllowed to the appropriate definition pattern, such as db.sect4 and db.sect5. For further section customizations, see DocBook 5: The Definitive Guide section 5.4. Removing Sectioning Elements for more ideas.
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