$Date$$Revision$Customizing DocBookcustomizingDocBook DTDDocBook DTDcustomizing
For the applications you have in mind, DocBook out of the
box may not be exactly what you need. Perhaps you need
additional inline elements or perhaps you want to remove elements that
you never want your authors to use. By design, DocBook makes this sort
of customization easy.
attributesDocBook DTD, customizingelementsDocBook DTD, customizing
This chapter explains how to make your own customization
layer. You might do this in order to:
Add new elementsRemove elementsChange the structure of existing elementsAdd new attributesRemove attributesBroaden the range of values allowed in an attributeNarrow the range of values in an attribute to a specific list or a fixed valueextensions, DocBook DTDenvironmentDocBook extensions, affecting
You can use customization layers to extend DocBook or subset
it. Creating a &DTD; that is a strict subset of DocBook means that all
of your instances are still completely valid DocBook instances, which
may be important to your tools and stylesheets, and to other people
with whom you share documents. An extension adds new
structures, or changes the &DTD; in a way that is not compatible with
DocBook. Extensions can be very useful, but might have a great impact
on your environment.
Customization layers can be as small as restricting an attribute value
or as large as adding an entirely different hierarchy on top of the
inline elements.
Should You Do This?stylesheetsDTD extension, effects
Changing a &DTD; can have a wide-ranging impact on the tools and
stylesheets that you use. It can have an impact on your authors and on
your legacy documents. This is especially true if you make an
extension. If you rely on your support staff to install and maintain
your authoring and publishing tools, check with them before you invest
a lot of time modifying the &DTD;. There may be additional issues that
are outside your immediate control. Proceed with caution.
That said, DocBook is designed to be easy to modify. This chapter
assumes that you are comfortable with &SGML;/&XML; &DTD; syntax, but
the examples presented should be a good springboard to learning the
syntax if it's not already familiar to you.
If You Change DocBook, It's Not DocBook Anymore!public identifiersDocBook DTDalteringThe DocBook &DTD; is usually referenced by its public identifier:
-//OASIS//DTD DocBook V3.1//EN
Previous versions of DocBook, V3.0 and the V2 variants, used the owner
identifier Davenport, rather than OASIS.
If you make any changes to the structure of the &DTD;, it is
imperative that you alter the public identifier that you use for the
&DTD; and the modules you changed. The license agreement under which
DocBook is distributed gives you complete freedom to change, modify,
reuse, and generally hack the &DTD; in any way you want, except that
you must not call your alterations DocBook.owner-identifierschanging (DocBook customization)description, changing (DocBook customization)
You should change both the owner identifier and the description. The
original DocBook formal public identifiers use the following syntax:
-//OASIS//text-class DocBook description Vversion//EN
Your own formal public identifiers should use the following syntax in
order to record their DocBook derivation:
-//your-owner-ID//text-class DocBook Vversion-Based Subset|Extension|Variantyour-descrip-and-version//langFor example:
-//O'Reilly//DTD DocBook V3.0-Based Subset V1.1//EN
subsets (DocBook DTD)
If your &DTD; is a proper subset, you can advertise this status by
using the Subset keyword in the description. If
your &DTD; contains any markup model extensions, you can advertise
this status by using the Extension keyword. If
you'd rather not characterize your variant specifically as a subset or
an extension, you can leave out this field entirely, or, if you
prefer, use the Variant keyword.
dbgenent.mod filepublic identifiersdbgenent.mod file, changing
There is only one file that you may change without changing the public
identifier: dbgenent.mod. And you can add only
entity and notation declarations to that file. (You can add anything
you want, naturally, but if you add anything other than entity and
notation declarations, you must change the public identifier!)
Customization LayerscustomizingDocBook DTDcustomization layerslayers, customization (DocBook DTD)parameter entitiescustomization layersdeclarationsSGML and XML DTDs
&SGML; and &XML; &DTD;s are really just collections of
declarations. These declarations are stored in one or more files. A
complete &DTD; is formed by combining these files together
logically. Parameter entities are used for this purpose. Consider the
following fragment:
<!ENTITY % dbpool SYSTEM "dbpool.mod">
<!ENTITY % dbhier SYSTEM "dbhier.mod">
%dbpool;
%dbhier; This line declares the
parameter entity dbpool and associates it with the
file dbpool.mod.This line declares the
parameter entity dbhier and associates it with the
file dbhier.mod.This line references
dbpool, which loads the file dbpool.mod
and inserts its content here.Similarly, this line loads
dbhier.mod.parsingDTDs, entity declarations (repeated)
It is an important feature of &DTD; parsing that entity
declarations can be repeated. If an entity is declared more than once,
then the first declaration is used. Given this
fragment:
<!ENTITY foo "Lenny">
<!ENTITY foo "Norm">
The replacement text for foo is
Lenny.modulesDTDs, customizingparameter entitiesDTD modules, referencing
These two notions, that you can break a &DTD; into modules referenced
with parameter entities and that the first entity declaration is the
one that counts, are used to build customization layers.
With customization layers you can write a &DTD; that references some
or all of DocBook, but adds your own modifications. Modifying the
&DTD; this way means that you never have to edit the DocBook modules
directly, which is a tremendous boon to maintaining your modules. When
the next release of DocBook comes out, you usually only have to make
changes to your customization layer and your modification will be back
in sync with the new version.
Customization layers work particularly well in DocBook because the
base &DTD; makes extensive use of parameter entities that can be
redefined.
Understanding DocBook Structure
DocBook is a large and, at first glance, fairly complex &DTD;. Much of
the apparent complexity is caused by the prolific use of parameter
entities. This was an intentional choice on the part of the
maintainers, who traded raw readability for customizability.
This section provides a general overview of the structure of the
&DTD;. After you understand it, DocBook will probably seem much less
complicated.
DocBook ModulesmodulesDocBookDocBook DTDmodules
DocBook is composed of seven primary modules. These modules decompose
the &DTD; into large, related chunks. Most modifications are
restricted to a single chunk.
shows the module structure of
DocBook as a flowchart.
Structure of the DocBook &DTD;
The modules are:
docbook.dtddriver files
The main driver file. This module declares and references the
other top-level modules.
dbhier.moddbhier.mod filehierarchical structureDocBook DTD
The hierarchy. This module declares the elements that provide
the hierarchical structure of DocBook (sets, books, chapters,
articles, and so on).
Changes to this module alter the top-level structure of the
&DTD;. If you want to write a DocBook-derived &DTD; with a different
structure (something other than a book), but with the same paragraph
and inline-level elements, you make most of your changes in this
module.
dbpool.moddbpool.mod fileelementsdbpool.mod file, declaringinline elementschanging (dbpool.mod file)
The information pool. This module declares the elements that
describe content (inline elements, bibliographic data, block quotes,
sidebars, and so on) but are not part of the large-scale hierarchy of
a document. You can incorporate these elements into an entirely
different element hierarchy.
The most common reason for changing this module is to add or
remove inline elements.
dbnotn.moddbnotn.mod filenotation declarations (DocBook)
The notation declarations. This module declares the notations
used by DocBook.
This module can be changed to add or remove notations.
dbcent.moddbcent.mod filecharactersentitiesdeclarationentitiescharactersdeclarationdeclarationsentitiesentity sets
The character entities. This module declares and references the
ISO entity sets used by DocBook.
Changes to this module can add or remove entity sets.
dbgenent.moddbgenent.mod fileentitiesgeneralcustomizingDocBook DTDgeneral entities, customizingcustomizingDocBook DTDgeneral entitiesgeneral entitiescustomizing
The general entities. This is a place where you can customize
the general entities available in DocBook instances.
This is the place to add, for example, boiler plate text, logos
for institutional identity, or additional notations understood by your
local processing system.
cals-tbl.dtdcals-tbl.dtd fileCALS; Table Model. CALStable models
The &CALS; Table Model. &CALS; is an initiative by the United
States Department of Defense to standardize the document types used
across branches of the military. The &CALS; table model, published in
MIL-HDBK-28001, was for a long time the most widely
supported &SGML; table model (one might now argue that the &HTML;
table model is more widely supported by some definitions of
widely supported). In any event, it is the table model
used by DocBook.
OASIStable modelDocBook DTDtable model
DocBook predates the publication of the
OASIS Technical Resolution TR
9503:1995, which defines an industry standard exchange table
model and thus incorporates the full &CALS; Table
Model.
parameter entitiestable model (CALS), modifying
Most changes to the &CALS; table model can be accomplished by
modifying parameter entities in dbpool.mod;
changing this &DTD; fragment is strongly discouraged. If you want to
use a different table model, remove this one and add your own.
*.gml*.gml (ISO standard character entity sets)ISO standardsentity setscharacters
The ISO standard character entity sets.
These entity sets are not actually part of the official DocBook
distribution, but are referenced by default.
There are some additional modules, initially undefined, that can be
inserted at several places for redeclaration. This is
described in more detail in .
DocBook Parameterizationparameter entitiescustomization layers
Customization layers are possible because DocBook has been extensively
parameterized so that it is possible to make any changes that might be
desired without ever editing the actual distributed modules. The
parameter entities come in several flavors:
*.class*.class parameter entitiesclasseselements
Classes group elements of a similar type: for example all the
lists are in the list.class.
If you want to add a new kind of something (a new kind of list
or a new kind of verbatim environment, for example), you generally
want to add the name of the new element to the appropriate class.
*.mix.mix parameter entitiesclassesmixtures
Mixtures are collections of classes that appear in content
models. For example, the content model of the
Example element includes example.mix. Not every element's content
model is a single mixture, but elements in the same class tend to have
the same mixture in their content model.
If you want to change the content model of some class of
elements (lists or admonitions, perhaps), you generally want to change
the definition of the appropriate mixture.
*.moduleparameter entities*.module*.module parameter entitiesmarked sectionsparameter entities, controlling
The *.module parameter
entities control marked sections around
individual elements and their attribute lists. For example, the
element and attribute declarations for Abbrev occur
within a marked section delimited by abbrev.module.
If you want to remove or redefine an element or its attribute
list, you generally want to change its module marked section to
IGNORE and possibly add a new definition for it in
your customization layer.
*.element*.element parameter entitiesparameter entities*.element
The *.element parameter
entities were introduced in DocBook V3.1; they
control marked sections around individual element declarations.
*.attlistparameter entities*.attlist*.attlist parameter entitiesattributesparameter entities, controlling
The *.attlist parameter
entities were introduced in DocBook V3.1; they
control marked sections around individual attribute list declarations.
*.inclusion*.exclusionelementsdeclarationsparameter entities, controllingparameter entities*.inclusionparameter entities*.exclusion*.inclusion parameter entities*.exclusion parameter entities
These parameter entities control the inclusion and exclusion
markup in element declarations.
Changing these declarations allows you to make global changes to
the inclusions and exclusions in the &DTD;.
local.*local parameter entities
The local.* parameter
entities are a local extension mechanism. You can add markup to most
entity declarations simply by declaring the appropriate local
parameter entity.
The General Structure ofCustomization LayerscustomizingDocBook DTDstructure (customization layers)
Although customization layers vary in complexity, most of them
have the same general structure as other customization layers of
similar complexity.
In the most common case, you probably want to include the entire &DTD;, but you
want to make some small changes. These customization layers tend
to look like this:
Overrides of Entity Declarations Here
<!ENTITY % orig-docbook "-//OASIS//DTD DocBook V3.1//EN">
%orig-docbook;
New/Modified Element and Attribute Declarations Here
Declare new values for parameter entities
(local.*,
*.element,
*.attlist)
that you wish to modify.
Include the entire DocBook &DTD; by parameter entity reference.
parameter entitiesDocBook DTD, including by reference
Add new element and attribute declarations for any elements that you
added to the &DTD;.
elementsdeclarationsadding for newattributesdeclarationsadding for newmodulesDocBook customization
In slightly more complex customization layers, the changes that you
want to make are influenced by the interactions between modules. In
these cases, rather than including the whole &DTD; at once, you
include each of the modules separately, perhaps with entity or element
declarations between them:
Overrides of Most Entity Declarations Here
<!ENTITY % orig-pool "-//OASIS//ELEMENTS DocBook Information Pool V3.1//EN">
%orig-pool;
Overrides of Document Hierarchy Entities Here
<!ENTITY % orig-hier "-//OASIS//ELEMENTS DocBook Document Hierarchy V3.1//EN">
%orig-hier;
New/Modified Element and Attribute Declarations Here
<!ENTITY % orig-notn "-//OASIS//ENTITIES DocBook Notations V3.1//EN">
%orig-notn;
<!ENTITY % orig-cent "-//OASIS//ENTITIES DocBook Character Entities V3.1//EN">
%orig-cent;
<!ENTITY % orig-gen "-//OASIS//ENTITIES DocBook Additional General Entities V3.1//EN">
%orig-gen;
one-off customizations
Finally, it's worth noting that in the rare case in which you
need certain kinds of very simple, one-off
customizations, you can do them in the document subset:
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V3.1//EN" [
Overrides of Entity Declarations HereNew/Modified Element and Attribute Declarations Here
]>
<book>...</book>
Writing, Testing, and Using a Customization LayerDocBook DTDcustomizingcustomization layers, writing, testing, and usingcustomizingDocBook DTDwriting, testing and using customization layers
The procedure for creating, testing, and using a customization layer
is always about the same. In this section, we'll go through the
process in some detail. The rest of the sections in this chapter
describe a range of useful customization layers.
Deciding What to Change
If you're considering writing a customization layer, there must be
something that you want to change. Perhaps you want to add an element
or attribute, remove one, or change some other aspect of the &DTD;.
inline elementsadding
Adding an element, particularly an inline element, is one possibility.
If you're writing documentation about an object-oriented system, you
may have noticed that DocBook provides ClassName but not
MethodName. Suppose you want to add
MethodName?
Deciding How to Change a Customization LayercustomizingDocBook DTDchanging customization layers
Figuring out what to change may be the hardest part of the process.
The organization of the parameter entities is quite logical, and,
bearing in mind the organization described in , finding something similar usually
provides a good model for new changes.
parameter entitiesreference (online)
Two online resources may be useful. First, the
parameter entity reference section of the
online book provides more detail than the print version. Second, there
is an alternate version of the book online that shows all of the element
content models in terms of the parameter entities that define them,
rather than the flattened versions shown here.
elementscontent models (online reference)
One resource that may be useful is the alternate version of this
book that shows all of the element content models in
terms of the parameter entities which define them, rather than
the flattened versions shown here. The alternate version
is on the CD-ROM and online at the book web site:
http://docbook.org/.
MethodName is similar to ClassName, so
ClassName is probably a good model. ClassName
is an inline element, not a hierarchy element, so it's in
dbpool.mod. Searching for classname in
dbpool.mod reveals:
<!ENTITY % local.tech.char.class "">
<!ENTITY % tech.char.class
"Action|Application|ClassName|Command|ComputerOutput
|Database|Email|EnVar|ErrorCode|ErrorName|ErrorType|Filename
|Function|GUIButton|GUIIcon|GUILabel|GUIMenu|GUIMenuItem
|GUISubmenu|Hardware|Interface|InterfaceDefinition|KeyCap
|KeyCode|KeyCombo|KeySym|Literal|Constant|Markup|MediaLabel
|MenuChoice|MouseButton|MsgText|Option|Optional|Parameter
|Prompt|Property|Replaceable|ReturnValue|SGMLTag|StructField
|StructName|Symbol|SystemItem|Token|Type|UserInput|VarName
%local.tech.char.class;">
Searching further reveals the element and attribute declarations for
ClassName.
local.tech.char.class parameter entitytech.char.class parameter entity
It would seem (and, in fact, it is the case) that adding
MethodName can be accomplished by adding it to the local
extension mechanism for tech.char.class, namely local.tech.char.class, and adding element and
attribute declarations for it. A customization layer that does this
can be seen in .
MethodName, adding with customization layerAdding MethodName with a Customization Layer
<!ENTITY % local.tech.char.class "|MethodName">
<!-- load DocBook -->
<!ENTITY % DocBookDTD PUBLIC "-//OASIS//DTD DocBook V3.1//EN">
%DocBookDTD;
<!ELEMENT MethodName - - ((%smallcptr.char.mix;)+) >
<!ATTLIST MethodName
%common.attrib;
%classname.role.attrib;
%local.classname.attrib;
>
Declare the appropriate
parameter entity (these are described in ).
The declaration in your customization layer is encountered first, so
it overrides the definition in the DocBook &DTD; (all the local
classes are defined as empty in the &DTD;).Use a parameter entity to
load the entire DocBook &DTD;.Add an element declaration
for the new element. The content model for this element is taken
directly from the content model of ClassName.Add an attribute list
declaration for the new element. These are the same attributes as
ClassName.
Using Your Customization LayercustomizingDocBook DTDwriting, testing, and using customization layersDocBook DTDcustomizingusing customization layer
In order to use the new customization layer, you must save it in a
file, for example mydocbk.dtd, and then you must use the
new &DTD; in your document.
The simplest way to use the new &DTD; is to point to it with a system
identifier:
Java Math classabsolute value (numbers), computingMy Chapter
The Java Math class provides a
abs method to compute absolute value of a number.
]]>
public identifiersDocBook DTDcustomization layer
If you plan to use your customization layer in many documents, or
exchange it with interchange partners, consider giving your &DTD; its
own public identifier, as described in catalog filespublic identifier, adding
In order to use the new public identifier, you must add it to your
catalog:
PUBLIC "-//Your Organization//DTD DocBook V3.1-Based Extension V1.0//EN"
"/share/sgml/mydocbk.dtd"
and use that public identifier in your documents:
My Chapter
The Java Math class provides a
abs method to compute absolute value of a number.
]]>
XMLsystem identifiersURI requirementsURIXML system identifiers
If you're using &XML;, remember that you must provide a system
identifier that satisfies the requirements of a Uniform Resource
Identifier (URI).
Testing Your WorkcustomizingDocBook DTDwriting, testing, and using customization layerstestingcustomization layers (DocBook DTD)validationcustomization layers
&DTD;s, by their nature, contain many complex, interrelated elements.
Whenever you make a change to the &DTD;, it's always wise to use a
validating parser to double-check your work. A parser like
nsgmls from James Clark's
SP can identify elements
(attributes, parameter entities) that are declared but unused, as well
as ones that are used but undeclared.
A comprehensive test can be accomplished with
nsgmls using the
option. Create a simple test document and run:
nsgmls -sv -wall test.sgm
suppressing output (parser)versionsnsgmls parser, printing number
The option
tells nsgmls to suppress its normal output (it will
still show errors, if there are any). The option
tells nsgmls to print its version number; this
ensures that you always get some output, even if
there are no errors.errorslisting, comprehensivewarnings, listingnsgmls parserwarning types
The
option tells nsgmls to provide a comprehensive list
of all errors and warnings. You can use less verbose, and more
specific options instead; for example, to
flag undefined elements or to warn you
about unused parameter entities. The nsgmls
documentation provides a complete list of warning types.DocBook V3.1 WarningsDocBook DTDwarnings
If you run the preceding command over DocBook V3.1,
you'll discover one warning generated by the &DTD;:
nsgmls:I: SP version "1.3"
nsgmls:cals-tbl.dtd:314:37:W: content model is mixed but does not allow #PCDATA everywhere
Entry element
This is not truly an error in the &DTD;, and can safely be ignored.
The warning is caused by pernicious mixed content in
the content model of DocBook's Entry element. See
the Entry reference page for a complete discussion.
Removing Elementselementsremoving
DocBook has a large number of elements. In some authoring
environments, it may be useful or necessary to remove some of these
elements.
Removing MsgSetMsgSet elementremovingMsgSet is a favorite target. It has a complex
internal structure designed for describing interrelated error
messages, especially on systems that may exhibit messages from several
different components. Many technical documents can do without it, and
removing it leaves one less complexity to explain to your authors.
shows a customization layer that removes the
MsgSet element from DocBook:
Removing MsgSet
<!ENTITY % compound.class "Procedure|SideBar">
<!ENTITY % msgset.content.module "IGNORE">
<!-- load DocBook -->
<!ENTITY % DocBookDTD PUBLIC "-//OASIS//DTD DocBook V3.1//EN">
%DocBookDTD;
Remove
MsgSet from the compound.class. This is the only place
in the &DTD; where MsgSet is referenced.Exclude the definition of
MsgSet and all of its subelements from the
&DTD;.Removing Computer Inlinesinline elementscomputer inlines, removingparameter entitiestech.char.class, redefiningtech.char.class parameter entityredefining
DocBook contains a large number of computer inlines. The DocBook
inlines define a domain-specific vocabulary. If you're working in
another domain, many of them may be unnecessary. You can remove a
bunch of them by redefining the tech.char.class parameter entity and
then excluding the declarations for the elements removed. The initial
definition of tech.char.class is:
<!ENTITY % tech.char.class
"Action|Application|ClassName|Command|ComputerOutput
|Database|Email|EnVar|ErrorCode|ErrorName|ErrorType|Filename
|Function|GUIButton|GUIIcon|GUILabel|GUIMenu|GUIMenuItem
|GUISubmenu|Hardware|Interface|InterfaceDefinition|KeyCap
|KeyCode|KeyCombo|KeySym|Literal|Markup|MediaLabel|MenuChoice
|MouseButton|MsgText|Option|Optional|Parameter|Prompt|Property
|Replaceable|ReturnValue|SGMLTag|StructField|StructName
|Symbol|SystemItem|Token|Type|UserInput
%local.tech.char.class;">
When examining this list, it seems that you can delete all of the
inlines except, perhaps, Application,
Command, Email,
Filename, Literal,
Replaceable, Symbol, and
SystemItem. The following customization layer
removes them.
Removing Computer Inlines
%DocBookDTD;
]]>
Initially we removed several more elements from tech.char.class (function.module, keycap.module), but using the testing procedure
described in , we discovered that
these elements are used in other content models. Because they are
used in other content modules, they cannot simply be removed from the
&DTD; by deleting them from
tech.char.class. Even though they can't be deleted
outright, we've taken them out of most inline contexts.
synopsessynopsis elements, removingFuncSynopsis elementremovingCmdSynopsis elementremoving
It's likely that a customization layer that removed this many
technical inlines would also remove some larger technical structures
(MsgSet, FuncSynopsis), which
allows you to remove additional elements from the &DTD;.
Removing Synopsis Elements
Another possibility is removing the complex Synopsis elements. The
customization layer in removes
CmdSynopsis and FuncSynopsis.
Removing CmdSynopsis and FuncSynopsis
%DocBookDTD;
]]>parameter entitiesempty
Completely removing all Synopsis elements would require a more
extensive customization. You can't make any of the *.class parameter entities completely empty
without changing all of the parameter entities that use them. See
.
Removing Sectioning Elementssectionselements, removing
Perhaps you want to restrict your authors to only three levels of
sectioning. To do that, you must remove the Sect4
and Sect5 elements, as shown in .
Removing Sect4 and Sect5 Elements
In order to completely remove an element that isn't in the information
pool, it is usually necessary to redefine the elements that include
it. In this case, because we're removing the Sect4
element, we must redefine the Sect3 element that
uses it.
Removing Admonitions from Table Entriesmodulesredeclarationsredeclarationsmodules
All of the customization layers that we've examined so far have been
fairly straightforward. This section describes a much more complex
customization layer. Back in we
mentioned that several additional modules existed for
redeclaration. The customization layer developed in this
section cannot be written without them.
admonitionsremoving from table entriestable entries, removing admonitions
The goal is to remove admonitions (Warning,
Caution, Note) from table
entries.
is a straightforward, and incorrect, attempt.
Removing Admonitions (First Attempt: Incorrect)
%DocBookDTD;
]]>
Because the parameter entity tabentry.mix defines the mixture of elements
allowed in table entries, you should remove admonitions.
parameter entitiestabentry.mix (removing admonitions)tabentry.mix element, editing
If you attempt to parse this &DTD;, you'll find that the declaration
of tabentry.mix contains errors. While
you can redefine parameter entities, you cannot make reference to
entities that have not been defined yet, so the use of list.class, linespecific.class, and so on, aren't allowed.
Your second attempt might look like .
Removing Admonitions (Second Attempt: Incorrect)
%DocBookDTD;
]]>
Declaring tabentry.mix after the &DTD;
has been loaded removes the errors.
This example contains no errors, but it also doesn't have any effect.
Remember, only the first entity declaration counts, so the declaration
of tabentry.mix in
dbpool.mod is the one used, not your
redeclaration.
placeholders, redeclarationsredeclarationsplaceholders
The only way to fix this problem is to make use of one of the redeclaration
placeholders in DocBook.
Redeclaration placeholders are spots in which you can insert
definitions into the middle of the &DTD;. There are four redeclaration
placeholders in DocBook:
%rdbmods parameter entityrdbmodsInserted in docbook.dtd, between
dbpool.mod and
dbhier.mod. This placeholder is controlled by the
intermod.redecl.module marked
section.rdbpool%rdbpool.mod parameter entity
Inserted in the middle of dbpool.mod,
between the *.class and *.mix entity declarations. This placeholder is
controlled by the dbpool.redecl.module
marked section.rdbhier%rdbhier parameter entity
Inserted in the middle of dbhier.mod,
between the *.class and *.mix entity declarations. This placeholder is
controlled by the dbhier.redecl.module marked
section.rdbhier2Also inserted into dbhier.mod, after the
*.mix entity declarations. This
placeholder is controlled by the dbhier.redecl2.module marked
section.Use the redeclaration placeholder that it occurs nearest to, but
before the entity that you want to redeclare. In our case, this is
rdbpool, as seen in .
Removing Admonitions (Third Attempt: Correct, if confusing)
'>
%DocBookDTD;
]]>escape sequences (parameter entities) uses numeric character entity
references to escape the % signs in the entity
declarations and nests an entity declaration in another parameter
entity. All of this is perfectly legal, but a bit confusing. A
clearer solution, and the only practical solution if you're doing
anything more than a single redeclaration, is to place the new
declarations in another file and include them in your customization
layer by reference, like this:
Removing Admonitions (Fourth Attempt: Correct)In your customization layer:
%DocBookDTD;
]]>In rdbpool.mod:
]]>Removing an Entire Classclassesremoving entire classelementsremovingparameter entitiesempty classes, redefining for
Perhaps the modification that you want to make is to completely remove
an entire class of elements. (If you have no need for synopsis
elements of any sort, why not remove them?) In order to remove an
entire class of elements, you must not only redefine the class as
empty, but you must also redefine all of the parameter entities that
use that class. The customization layer below completely removes the
synop.class from DocBook. It
requires a customization layer, shown in , that includes both a redeclaration module in
dbpool.mod and a redeclaration module in
dbhier.mod.
%synop.class, removingRemoving synop.classIn the customization layer:In remv.synop.class.rdbpool.mod:In remv.synop.class.rdbhier.mod:Removing AttributesJust as there may be more elements than you need, there may be more
attributes.Removing an AttributeattributesremovingRenderAs attribute, removing
Suppose you want to remove the RenderAs attribute from the
Sect1 element. RenderAs allows the author to
cheat in the presentation of hierarchy by specifying
that the stylesheet should render a Sect1 as
something else: a Sect3, perhaps. details the removal of RenderAs.
Removing RenderAs from Sect1
<!ENTITY % sect1.module "IGNORE">
<!-- load DocBook -->
<!ENTITY % DocBookDTD PUBLIC "-//OASIS//DTD DocBook V3.1//EN">
%DocBookDTD;
<!ENTITY % local.sect1.attrib "">
<!ENTITY % sect1.role.attrib "%role.attrib;">
<!ELEMENT Sect1 - O (Sect1Info?, (%sect.title.content;), (%nav.class;)*,
(((%divcomponent.mix;)+,
((%refentry.class;)* | Sect2* | SimpleSect*))
| (%refentry.class;)+ | Sect2+ | SimpleSect+), (%nav.class;)*)
+(%ubiq.mix;)>
<!ATTLIST Sect1
%label.attrib;
%status.attrib;
%common.attrib;
%sect1.role.attrib;
%local.sect1.attrib;
>
Turn off the
Sect1 module so that the element and attribute
declarations in the &DTD; will be ignored.
Include the DocBook &DTD;.By keeping the local attribute
declaration, we leave open the possibility of a simple customization
layer on top of our customization layer.Similarly, we keep the
parameterized definition of the Role
attribute.We're changing the attribute
list, not the element, so we've simply copied the
Sect1 element declaration from the DocBook
&DTD;.Finally, we declare the attribute
list, leaving out the RenderAs.Subsetting the Common Attributesattributescommonsubsettingsubsetting common attributes
DocBook defines eleven common attributes; these attributes appear on
every element. Depending on how you're
processing your documents, removing some of them can both simplify the
authoring task and improve processing speed.
Some obvious candidates are:Effectivity attributes (Arch
, OS,...)effectivity attributes, removing
If you're not using all of the effectivity attributes in your
documents, you can get rid of up to seven attributes in one fell
swoop.LangLang attributeremoving
If you're not producing multilingual documents, you can remove
Lang.RemapRemap attributeremoving
The Remap attribute is
designed to hold the name of a semantically equivalent construct from
a previous markup scheme (for example, a Microsoft Word style template
name, if you're converting from Word). If you're authoring from
scratch, or not preserving previous constructs with Remap, you can get rid of it.XrefLabelXrefLabel attributeremoving
If your processing system isn't using XrefLabel, it's a candidate as
well.
The customization layer in reduces the
common attributes to just ID and
Lang.
Removing Common Attributes
%DocBookDTD;]]>common.attrib parameter entityidreq.common.attrib parameter entity
By definition, whatever attributes you define in the common.attrib and idreq.common.attrib parameter entities
are the common attributes. In dbpool.mod , these
parameter entities are defined in terms of other parameter entities,
but there's no way to preserve that structure in your customization
layer.
Adding Elements: Adding a Sect6elementsadding
Adding a structural (as opposed to information pool) element generally
requires adding its name to a class and then providing the appropriate
definitions. extends DocBook by adding a
Sect6 element.
Adding a Sect6 Element
%DocBookDTD;
]]>
Here we've redefined Sect5 to include
Sect6 and provided a declaration for
Sect6. Note that we didn't bother to provide
RenderAs attributes in our
redefinitions. To properly support Sect6, you might
want to redefine all of the sectioning elements so that
Sect6 is a legal attribute value for RenderAs.
Other Modifications: Classifying a RoleRole attributechanging on Procedure (example)
The Role attribute, found on almost
all of the elements in DocBook, is a CDATA attribute that
can be used to subclass an element. In some applications, it may be useful
to modify the definition of Role so that
authors must choose one of a specific set of possible values.In , Role on the Procedure element
is constrained to the values Required or
Optional.Changing Role on Procedure
%DocBookDTD;]]>