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

  1. 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 sect5 and redefine sect4 without a sect5.

  1. 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;

  1. Redefining sect4
    Insert the following line from dbhierx.mod, but omit sect5:

<!ELEMENT sect4 %ho; (sect4info?, 
     (%sect.title.content;), (%nav.class;)*, 
     (((%divcomponent.mix;)+, 
     ((%refentry.class;)* | simplesect*)) 
     | (%refentry.class;)+ | simplesect+), (%nav.class;)*)>

  1. 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.

  

back to top