XML technologies / DocBook / Customizing DocBook / Removing elements / Removing an entire class
(Excerpt from "DocBook-XML: Media-neutral and platform-independent publishing" by Thomas Schraitle)
You may need to remove an entire class of elements, such as inline graphics or inline equations. In DocBook 4, this is slightly more complex than the previous customizations. Proceed as follows:
Customizing DocBook 4
Procedure: Removing inline graphics, equations, etc. in DocBook 4
Disabling
%informal.class;
Add this line to your customization file:
<!ENTITY % informal.class "">Enabling redeclaration parameters
Add these lines:
<!ENTITY % dbhier.redecl.module "INCLUDE">
<!ENTITY % rdbhier SYSTEM "db-informal.rdbhier.mod">
<!ENTITY % dbpool.redecl.module "INCLUDE">
<!ENTITY % rdbpool SYSTEM "db-informal.rdbpool.mod">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;Creating the file
db-informal.rdbpool.mod
Create a filedb-informal.rdbpool.mod. This file no longer contains any%informal.class;-entities:
<!ENTITY % local.component.mix "">
<!ENTITY % component.mix
"%list.class; |%admon.class;
|%linespecific.class; |%synop.class;
|%para.class;
|%formal.class; |%compound.class;
|%genobj.class; |%descobj.class;
|%ndxterm.class; |beginpage
%local.component.mix;">
<!ENTITY % local.sidebar.mix "">
<!ENTITY % sidebar.mix
"%list.class; |%admon.class;
|%linespecific.class; |%synop.class;
|%para.class;
|%formal.class; |procedure
|%genobj.class;
|%ndxterm.class; |beginpage
%local.sidebar.mix;">
<!ENTITY % local.qandaset.mix "">
<!ENTITY % qandaset.mix
"%list.class; |%admon.class;
|%linespecific.class; |%synop.class;
|%para.class;
|%formal.class; |procedure
|%genobj.class;
|%ndxterm.class;
%local.qandaset.mix;">
<!ENTITY % local.revdescription.mix "">
<!ENTITY % revdescription.mix
"%list.class; |%admon.class;
|%linespecific.class; |%synop.class;
|%para.class;
|%formal.class; |procedure
|%genobj.class;
|%ndxterm.class;
%local.revdescription.mix;">
<!ENTITY % local.footnote.mix "">
<!ENTITY % footnote.mix
"%list.class;
|%linespecific.class; |%synop.class;
|%para.class;
%local.footnote.mix;">
<!ENTITY % local.example.mix "">
<!ENTITY % example.mix
"%list.class;
|%linespecific.class; |%synop.class;
|%para.class;
|%ndxterm.class; |beginpage
%local.example.mix;">
<!ENTITY % local.highlights.mix "">
<!ENTITY % highlights.mix
"%list.class; |%admon.class;
|%para.class;
|%ndxterm.class;
%local.highlights.mix;">
<!ENTITY % local.para.mix "">
<!ENTITY % para.mix
"%list.class; |%admon.class;
|%linespecific.class;
|%formal.class;
%local.para.mix;">
<!ENTITY % local.admon.mix "">
<!ENTITY % admon.mix
"%list.class;
|%linespecific.class; |%synop.class;
|%para.class;
|%formal.class; |procedure|sidebar
|anchor|bridgehead|remark
|%ndxterm.class; |beginpage
%local.admon.mix;">Creating the file
db-informal.rdbhier.mod
Create a filedb-informal.rdbhier.mod.This file contains all%*.mix;entities present indbhierx.mod:
<!ENTITY % local.divcomponent.mix "">
<!ENTITY % divcomponent.mix
"%list.class; |%admon.class;
|%linespecific.class; |%synop.class;
|%para.class;
|%formal.class; |%compound.class;
|%genobj.class; |%descobj.class;
|%ndxterm.class; |beginpage
%forms.hook;
%local.divcomponent.mix;">
<!ENTITY % local.refcomponent.mix "">
<!ENTITY % refcomponent.mix
"%list.class; |%admon.class;
|%linespecific.class; |%synop.class;
|%para.class;
|%formal.class; |%compound.class;
|%genobj.class; |%descobj.class;
|%ndxterm.class; |beginpage
%local.refcomponent.mix;">
<!ENTITY % local.indexdivcomponent.mix "">
<!ENTITY % indexdivcomponent.mix
"itemizedlist|orderedlist |variablelist|simplelist
|%linespecific.class; |%synop.class;
|%para.class;
|anchor|remark
|%link.char.class;
|beginpage
%local.indexdivcomponent.mix;">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
DocBook 5 customizations are much simpler. Proceed as follows:
Procedure: Removing inline graphics, equations, etc. in DocBook 5
Creating the customization file
Create a customization file with this content:
<grammar ns="http://docbook.org/ns/docbook" xmlns:db="http://docbook.org/ns/docbook" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0">
<include href="docbook.rng">
<!-- Ihre Anpassungen -->
</include>
</grammar>namespace db = "http://docbook.org/ns/docbook"
default namespace = "http://docbook.org/ns/docbook"
include "docbook.rnc" {
# Ihre Anpassungen
}Identifying pattern names
Find thedb.*.inlinesyou want to remove from DocBook 5. For the requirement above, these aredb.graphic.inlinesanddb.math.inlines. Add:
<!-- Ihre Anpassungen -->
<define name="db.graphic.inlines">
<notAllowed/>
</define>
<define name="db.math.inlines">
<notAllowed/>
</define># Ihre Anpassungen
db.graphic.inlines = notAllowed
db.math.inlines = notAllowedUsing the customization file
Use the customization file instead of the original DocBook file (see Validating with a DocBook 5 customization file).
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