xml2po cleanup.
[docbook-zh.git] / defguide / en / ch05.xml
blobb285c5d8aec6582e7bbbdd449fc452427336b2c8
1 <chapter id="app-customizing">
2 <?dbhtml filename="ch05.html"?>
3 <chapterinfo>
4 <pubdate>$Date: 2009-01-05 17:25:13 +0800 (Mon, 05 Jan 2009) $</pubdate>
5 <releaseinfo>$Revision: 8201 $</releaseinfo>
6 </chapterinfo>
7 <title>Customizing DocBook</title> 
8 <para>
9 <indexterm id="customDocBookch05" class="startofrange"><primary>customizing</primary>
10   <secondary>DocBook DTD</secondary></indexterm>
11 <indexterm id="DocBookcustomch05" class="startofrange"><primary>DocBook DTD</primary>
12   <secondary>customizing</secondary></indexterm>
14 For the applications you have in mind, DocBook <quote>out of the
15 box</quote> may not be exactly what you need. Perhaps you need
16 additional inline elements or perhaps you want to remove elements that
17 you never want your authors to use. By design, DocBook makes this sort
18 of customization easy.
19 </para>
20 <para>
21 <indexterm><primary>attributes</primary>
22   <secondary>DocBook DTD, customizing</secondary></indexterm>
23 <indexterm><primary>elements</primary>
24   <secondary>DocBook DTD, customizing</secondary></indexterm>
26 This chapter explains how to make your own <firstterm>customization
27 layer</firstterm>. You might do this in order to:
28 <itemizedlist>
29 <listitem><para>Add new elements</para></listitem>
30 <listitem><para>Remove elements</para></listitem>
31 <listitem><para>Change the structure of existing elements</para></listitem>
32 <listitem><para>Add new attributes</para></listitem>
33 <listitem><para>Remove attributes</para></listitem>
34 <listitem><para>Broaden the range of values allowed in an attribute</para></listitem>
35 <listitem><para>Narrow the range of values in an attribute to a specific list or a fixed value</para></listitem>
36 </itemizedlist>
37 </para>
38 <para>
39 <indexterm><primary>extensions, DocBook DTD</primary></indexterm>
40 <indexterm><primary>environment</primary>
41   <secondary>DocBook extensions, affecting</secondary></indexterm>
43 You can use customization layers to extend DocBook or subset
44 it. Creating a &DTD; that is a strict subset of DocBook means that all
45 of your instances are still completely valid DocBook instances, which
46 may be important to your tools and stylesheets, and to other people
47 with whom you share documents.  An <firstterm>extension</firstterm> adds new
48 structures, or changes the &DTD; in a way that is not compatible with
49 DocBook. Extensions can be very useful, but might have a great impact
50 on your environment.
51 </para>
52 <para>
53 Customization layers can be as small as restricting an attribute value
54 or as large as adding an entirely different hierarchy on top of the
55 inline elements.
56 </para>
57 <sect1 id="ch05-shouldi"><title>Should You Do This?</title>
58 <para>
59 <indexterm><primary>stylesheets</primary>
60   <secondary>DTD extension, effects</secondary></indexterm>
62 Changing a &DTD; can have a wide-ranging impact on the tools and
63 stylesheets that you use. It can have an impact on your authors and on
64 your legacy documents.  This is especially true if you make an
65 extension. If you rely on your support staff to install and maintain
66 your authoring and publishing tools, check with them before you invest
67 a lot of time modifying the &DTD;. There may be additional issues that
68 are outside your immediate control. Proceed with caution.
69 </para>
70 <para>
71 That said, DocBook is designed to be easy to modify. This chapter
72 assumes that you are comfortable with &SGML;/&XML; &DTD; syntax, but
73 the examples presented should be a good springboard to learning the
74 syntax if it's not already familiar to you.
75 </para>
76 </sect1>
77 <sect1 id="s-notdocbook"><title>If You Change DocBook, It's Not DocBook Anymore!</title>
78 <para>
79 <indexterm>
80   <primary>public identifiers</primary>
81   <secondary>DocBook DTD</secondary>
82   <tertiary>altering</tertiary>
83 </indexterm>The DocBook &DTD; is usually referenced by its public identifier:
84 </para>
85 <screen>  -//OASIS//DTD DocBook V3.1//EN</screen>
86 <para>
87 Previous versions of DocBook, V3.0 and the V2 variants, used the owner
88 identifier Davenport, rather than OASIS.
89 </para>
90 <para>
91 If you make any changes to the structure of the &DTD;, it is
92 imperative that you alter the public identifier that you use for the
93 &DTD; and the modules you changed.  The license agreement under which
94 DocBook is distributed gives you complete freedom to change, modify,
95 reuse, and generally hack the &DTD; in any way you want, except that
96 you must not call your alterations <quote>DocBook.</quote>
97 </para>
98 <para>
99 <indexterm><primary>owner-identifiers</primary>
100   <secondary>changing (DocBook customization)</secondary></indexterm>
101 <indexterm><primary>description, changing (DocBook customization)</primary></indexterm>
103 You should change both the owner identifier and the description. The
104 original DocBook formal public identifiers use the following syntax:
105 <screen>
106 -//OASIS//<replaceable>text-class</replaceable> DocBook <replaceable>description</replaceable> V<replaceable>version</replaceable>//EN
107 </screen>
108 </para>
109 <para>
110 Your own formal public identifiers should use the following syntax in
111 order to record their DocBook derivation:
112 <screen>
113 -//<replaceable>your-owner-ID</replaceable>//<replaceable>text-class</replaceable> DocBook V<replaceable>version</replaceable>-Based <optional>Subset|Extension|Variant</optional> <replaceable>your-descrip-and-version</replaceable>//<replaceable>lang</replaceable>
114 </screen>
115 </para>
116 <para>For example:
117 <screen>
118 -//O'Reilly//DTD DocBook V3.0-Based Subset V1.1//EN
119 </screen>
120 </para>
121 <para>
122 <indexterm><primary>subsets (DocBook DTD)</primary></indexterm>
123 If your &DTD; is a proper subset, you can advertise this status by
124 using the <literal>Subset</literal> keyword in the description. If
125 your &DTD; contains any markup model extensions, you can advertise
126 this status by using the <literal>Extension</literal> keyword. If
127 you'd rather not characterize your variant specifically as a subset or
128 an extension, you can leave out this field entirely, or, if you
129 prefer, use the <literal>Variant</literal> keyword.
130 </para>
131 <para>
132 <indexterm><primary>dbgenent.mod file</primary></indexterm>
133 <indexterm><primary>public identifiers</primary>
134   <secondary>dbgenent.mod file, changing</secondary></indexterm>
136 There is only one file that you may change without changing the public
137 identifier: <filename>dbgenent.mod</filename>. And you can add only
138 entity and notation declarations to that file. (You can add anything
139 you want, naturally, but if you add anything other than entity and
140 notation declarations, you must change the public identifier!)
141 </para>
142 </sect1>
143 <sect1 id="ch05-layers"><title>Customization Layers</title>
144 <para>
145 <indexterm><primary>customizing</primary>
146   <secondary>DocBook DTD</secondary>
147     <tertiary>customization layers</tertiary></indexterm>
148 <indexterm><primary>layers, customization (DocBook DTD)</primary></indexterm>
149 <indexterm><primary>parameter entities</primary>
150   <secondary>customization layers</secondary></indexterm>
151 <indexterm><primary>declarations</primary>
152   <secondary>SGML and XML DTDs</secondary></indexterm>
154 &SGML; and &XML; &DTD;s are really just collections of
155 declarations. These declarations are stored in one or more files. A
156 complete &DTD; is formed by combining these files together
157 logically. Parameter entities are used for this purpose. Consider the
158 following fragment:
159 </para>
160 <screen>
161 &lt;!ENTITY % dbpool SYSTEM "dbpool.mod"> <co id="cl-dbpooldcl"/>
162 &lt;!ENTITY % dbhier SYSTEM "dbhier.mod"> <co id="cl-dbhierdcl"/>
163 %dbpool;                               <co id="cl-dbpooluse"/>
164 %dbhier;                               <co id="cl-dbhieruse"/>
165 </screen>
166 <calloutlist>
167 <callout arearefs="cl-dbpooldcl"><para>This line declares the
168 parameter entity <literal>dbpool</literal> and associates it with the
169 file <filename> dbpool.mod</filename>.</para>
170 </callout>
171 <callout arearefs="cl-dbhierdcl"><para>This line declares the
172 parameter entity <literal>dbhier</literal> and associates it with the
173 file <filename> dbhier.mod</filename>.</para>
174 </callout>
175 <callout arearefs="cl-dbpooluse"><para>This line references <literal>
176 dbpool</literal>, which loads the file <filename>dbpool.mod</filename>
177 and inserts its content here.</para>
178 </callout>
179 <callout arearefs="cl-dbhieruse"><para>Similarly, this line loads
180 <filename> dbhier.mod</filename>.</para> </callout></calloutlist>
181 <para>
182 <indexterm><primary>parsing</primary>
183   <secondary>DTDs, entity declarations (repeated)</secondary></indexterm>
185 It is an important feature of &DTD; parsing that entity
186 declarations can be repeated. If an entity is declared more than once,
187 then the <emphasis> first</emphasis> declaration is used. Given this
188 fragment:
189 </para>
190 <screen>
191 &lt;!ENTITY foo "Lenny">
192 &lt;!ENTITY foo "Norm">
193 </screen>
194 <para>
195 The replacement text for <sgmltag class="genentity">foo</sgmltag> is
196 <quote>Lenny.</quote>
197 </para>
198 <para>
199 <indexterm><primary>modules</primary>
200   <secondary>DTDs, customizing</secondary></indexterm>
201 <indexterm><primary>parameter entities</primary>
202   <secondary>DTD modules, referencing</secondary></indexterm>
204 These two notions, that you can break a &DTD; into modules referenced
205 with parameter entities and that the first entity declaration is the
206 one that counts, are used to build <quote>customization layers.</quote>
207 With customization layers you can write a &DTD; that references some
208 or all of DocBook, but adds your own modifications. Modifying the
209 &DTD; this way means that you never have to edit the DocBook modules
210 directly, which is a tremendous boon to maintaining your modules. When
211 the next release of DocBook comes out, you usually only have to make
212 changes to your customization layer and your modification will be back
213 in sync with the new version.
214 </para>
215 <para>
216 Customization layers work particularly well in DocBook because the
217 base &DTD; makes extensive use of parameter entities that can be
218 redefined.
219 </para>
220 </sect1>
221 <sect1 id="s-dbstruct"><title>Understanding DocBook Structure</title>
222 <para>
223 DocBook is a large and, at first glance, fairly complex &DTD;. Much of
224 the apparent complexity is caused by the prolific use of parameter
225 entities.  This was an intentional choice on the part of the
226 maintainers, who traded <quote>raw readability</quote> for customizability.
227 This section provides a general overview of the structure of the
228 &DTD;. After you understand it, DocBook will probably seem much less
229 complicated.
230 </para>
231 <sect2 id="db-modules"><title>DocBook Modules</title>
232 <para>
233 <indexterm><primary>modules</primary>
234   <secondary>DocBook</secondary></indexterm>
235 <indexterm><primary>DocBook DTD</primary>
236   <secondary>modules</secondary></indexterm>
238 DocBook is composed of seven primary modules. These modules decompose
239 the &DTD; into large, related chunks. Most modifications are
240 restricted to a single chunk.
241 </para>
242 <para>
243 <xref linkend="fg-docbook-flowchart"/> shows the module structure of
244 DocBook as a flowchart.
245 </para>
246 <figure id="fg-docbook-flowchart">
247 <title>Structure of the DocBook &DTD;</title>
248 <graphic fileref="figures/docbook-module-flowchart.png"></graphic>
249 </figure>
250 <para>
251 The modules are:
252 </para>
253 <variablelist>
254 <varlistentry><term><filename>docbook.dtd</filename></term>
255 <listitem>
256 <para>
257 <indexterm><primary>driver files</primary></indexterm>
259 The main driver file. This module declares and references the
260 other top-level modules.
261 </para>
262 </listitem>
263 </varlistentry>
264 <varlistentry><term><filename>dbhier.mod</filename></term>
265 <listitem>
266 <para>
267 <indexterm><primary>dbhier.mod file</primary></indexterm>
268 <indexterm><primary>hierarchical structure</primary>
269   <secondary>DocBook DTD</secondary></indexterm>
271 The hierarchy. This module declares the elements that provide
272 the hierarchical structure of DocBook (sets, books, chapters,
273 articles, and so on).
274 </para>
275 <para>Changes to this module alter the top-level structure of the
276 &DTD;. If you want to write a DocBook-derived &DTD; with a different
277 structure (something other than a book), but with the same paragraph
278 and inline-level elements, you make most of your changes in this
279 module.
280 </para>
281 </listitem>
282 </varlistentry>
283 <varlistentry><term><filename>dbpool.mod</filename></term>
284 <listitem>
285 <para>
286 <indexterm><primary>dbpool.mod file</primary></indexterm>
287 <indexterm><primary>elements</primary>
288   <secondary>dbpool.mod file, declaring</secondary></indexterm>
289 <indexterm><primary>inline elements</primary>
290   <secondary>changing (dbpool.mod file)</secondary></indexterm>
292 The information pool. This module declares the elements that
293 describe content (inline elements, bibliographic data, block quotes,
294 sidebars, and so on) but are not part of the large-scale hierarchy of
295 a document. You can incorporate these elements into an entirely
296 different element hierarchy.
297 </para>
298 <para>The most common reason for changing this module is to add or
299 remove inline elements.
300 </para>
301 </listitem>
302 </varlistentry>
303 <varlistentry><term><filename>dbnotn.mod</filename></term>
304 <listitem>
305 <para>
306 <indexterm><primary>dbnotn.mod file</primary></indexterm>
307 <indexterm><primary>notation declarations (DocBook)</primary></indexterm>
309 The notation declarations. This module declares the notations
310 used by DocBook.
311 </para>
312 <para>This module can be changed to add or remove notations.
313 </para>
314 </listitem>
315 </varlistentry>
316 <varlistentry><term><filename>dbcent.mod</filename></term>
317 <listitem>
318 <para>
319 <indexterm><primary>dbcent.mod file</primary></indexterm>
320 <indexterm><primary>characters</primary>
321   <secondary>entities</secondary>
322     <tertiary>declaration</tertiary></indexterm>
323 <indexterm><primary>entities</primary>
324   <secondary>characters</secondary>
325     <tertiary>declaration</tertiary></indexterm>
326 <indexterm><primary>declarations</primary>
327   <secondary>entities</secondary>
328     <tertiary>entity sets</tertiary></indexterm>
330 The character entities. This module declares and references the
331 <acronym>ISO</acronym> entity sets used by DocBook.
332 </para>
333 <para>Changes to this module can add or remove entity sets.
334 </para>
335 </listitem>
336 </varlistentry>
337 <varlistentry><term><filename>dbgenent.mod</filename></term>
338 <listitem>
339 <para>
340 <indexterm><primary>dbgenent.mod file</primary></indexterm>
341 <indexterm><primary>entities</primary>
342   <secondary>general</secondary>
343     <tertiary>customizing</tertiary></indexterm>
344 <indexterm><primary>DocBook DTD</primary>
345   <secondary>general entities, customizing</secondary></indexterm>
346 <indexterm><primary>customizing</primary>
347   <secondary>DocBook DTD</secondary>
348     <tertiary>general entities</tertiary></indexterm>
349 <indexterm><primary>general entities</primary>
350   <secondary>customizing</secondary></indexterm>
352 The general entities. This is a place where you can customize
353 the general entities available in DocBook instances.
354 </para>
355 <para>This is the place to add, for example, boiler plate text, logos
356 for institutional identity, or additional notations understood by your
357 local processing system.
358 </para>
359 </listitem>
360 </varlistentry>
361 <varlistentry><term><filename>cals-tbl.dtd</filename></term>
362 <listitem>
363 <para>
364 <indexterm><primary>cals-tbl.dtd file</primary></indexterm>
365 <indexterm><primary>CALS; Table Model. CALS</primary></indexterm>
366 <indexterm><primary>table models</primary></indexterm>
368 The &CALS; Table Model. &CALS; is an initiative by the United
369 States Department of Defense to standardize the document types used
370 across branches of the military. The &CALS; table model, published in
371 <acronym>MIL-HDBK-28001</acronym>, was for a long time the most widely
372 supported &SGML; table model (one might now argue that the &HTML;
373 table model is more widely supported by some definitions of
374 <quote>widely supported</quote>). In any event, it is the table model
375 used by DocBook.
376 </para>
377 <para>
378 <indexterm><primary>OASIS</primary>
379   <secondary>table model</secondary></indexterm>
380 <indexterm><primary>DocBook DTD</primary>
381   <secondary>table model</secondary></indexterm>
383 DocBook predates the publication of the <ulink url="http://www.oasis-open.org/html/a503.htm">
384 <acronym>OASIS</acronym> Technical Resolution <acronym>TR</acronym>
385 9503:1995</ulink>, which defines an industry standard exchange table
386 model and thus incorporates the <emphasis>full</emphasis> &CALS; Table
387 Model.
388 </para>
389 <para>
390 <indexterm><primary>parameter entities</primary>
391   <secondary>table model (CALS), modifying</secondary></indexterm>
393 Most changes to the &CALS; table model can be accomplished by
394 modifying parameter entities in <filename>dbpool.mod</filename>;
395 changing this &DTD; fragment is strongly discouraged. If you want to
396 use a different table model, remove this one and add your own.
397 </para>
398 </listitem>
399 </varlistentry>
400 <varlistentry><term><filename>*.gml</filename></term>
401 <listitem>
402 <para>
403 <indexterm><primary sortas="gml ISO standard character entity sets">*.gml (ISO standard character entity sets)</primary></indexterm>
404 <indexterm><primary>ISO standards</primary>
405   <secondary>entity sets</secondary>
406     <tertiary>characters</tertiary></indexterm>
407 The <acronym>ISO</acronym> standard character entity sets.
408 These entity sets are not actually part of the official DocBook
409 distribution, but are referenced by default.
410 </para>
411 </listitem>
412 </varlistentry>
413 </variablelist>
414 <para>
415 There are some additional modules, initially undefined, that can be
416 inserted at several places for <quote>redeclaration.</quote> This is
417 described in more detail in <xref linkend="s2-remvadmon"/>.
418 </para>
419 </sect2>
420 <sect2 id="dbparam"><title>DocBook Parameterization</title>
421 <para>
422 <indexterm><primary>parameter entities</primary>
423   <secondary>customization layers</secondary></indexterm>
425 Customization layers are possible because DocBook has been extensively
426 parameterized so that it is possible to make any changes that might be
427 desired without ever editing the actual distributed modules. The
428 parameter entities come in several flavors:
429 </para>
430 <variablelist>
431 <varlistentry><term><sgmltag class="paramentity">*.class</sgmltag></term>
432 <listitem>
433 <para>
434 <indexterm><primary sortas="class parameter entities">*.class parameter entities</primary></indexterm>
435 <indexterm><primary>classes</primary>
436   <secondary>elements</secondary></indexterm>
438 Classes group elements of a similar type: for example all the
439 lists are in the <sgmltag class="paramentity">list.class</sgmltag>.
440 </para>
441 <para>If you want to add a new kind of something (a new kind of list
442 or a new kind of verbatim environment, for example), you generally
443 want to add the name of the new element to the appropriate class.
444 </para>
445 </listitem>
446 </varlistentry>
447 <varlistentry><term><sgmltag class="paramentity">*.mix</sgmltag></term>
448 <listitem>
449 <para>
450 <indexterm><primary sortas="mix mixture classes">.mix parameter entities</primary></indexterm>
451 <indexterm><primary>classes</primary>
452   <secondary>mixtures</secondary></indexterm>
454 Mixtures are collections of classes that appear in content
455 models. For example, the content model of the
456 <sgmltag>Example</sgmltag> element includes <sgmltag class="paramentity">example.mix</sgmltag>. Not every element's content
457 model is a single mixture, but elements in the same class tend to have
458 the same mixture in their content model.
459 </para>
460 <para>If you want to change the content model of some class of
461 elements (lists or admonitions, perhaps), you generally want to change
462 the definition of the appropriate mixture.
463 </para>
464 </listitem>
465 </varlistentry>
466 <varlistentry><term><sgmltag class="paramentity">*.module</sgmltag></term>
467 <listitem>
468 <para>
469 <indexterm><primary>parameter entities</primary>
470   <secondary>*.module</secondary></indexterm>
472 <indexterm><primary sortas="module files">*.module parameter entities</primary></indexterm>
473 <indexterm><primary>marked sections</primary>
474   <secondary>parameter entities, controlling</secondary></indexterm>
476 The <sgmltag class="paramentity">*.module</sgmltag> parameter
477 entities control <link linkend="s-ms">marked sections</link> around
478 individual elements and their attribute lists.  For example, the
479 element and attribute declarations for <sgmltag>Abbrev</sgmltag> occur
480 within a marked section delimited by <sgmltag class="paramentity">abbrev.module</sgmltag>.
481 </para>
482 <para>
483 If you want to remove or redefine an element or its attribute
484 list, you generally want to change its module marked section to
485 <literal>IGNORE</literal> and possibly add a new definition for it in
486 your customization layer.
487 </para>
488 </listitem>
489 </varlistentry>
490 <varlistentry><term><sgmltag class="paramentity">*.element</sgmltag></term>
491 <listitem>
492 <para>
493 <indexterm><primary sortas="element parameter entity">*.element parameter entities</primary></indexterm>
494 <indexterm><primary>parameter entities</primary>
495   <secondary>*.element</secondary></indexterm>
496 The <sgmltag class="paramentity">*.element</sgmltag> parameter
497 entities were introduced in DocBook <acronym>V3.1</acronym>; they
498 control marked sections around individual element declarations.
499 </para>
500 </listitem>
501 </varlistentry>
502 <varlistentry><term><sgmltag class="paramentity">*.attlist</sgmltag></term>
503 <listitem>
504 <para>
505 <indexterm><primary>parameter entities</primary>
506   <secondary>*.attlist</secondary></indexterm>
507 <indexterm><primary sortas="attlist parameter entities">*.attlist parameter entities</primary></indexterm>
508 <indexterm><primary>attributes</primary>
509   <secondary>parameter entities, controlling</secondary></indexterm>
511 The <sgmltag class="paramentity">*.attlist</sgmltag> parameter
512 entities were introduced in DocBook <acronym>V3.1</acronym>; they
513 control marked sections around individual attribute list declarations.
514 </para>
515 </listitem>
516 </varlistentry>
517 <varlistentry><term><sgmltag class="paramentity">*.inclusion</sgmltag></term>
518 <term><sgmltag class="paramentity">*.exclusion</sgmltag></term>
519 <listitem>
520 <para>
521 <indexterm><primary>elements</primary>
522   <secondary>declarations</secondary>
523     <tertiary>parameter entities, controlling</tertiary></indexterm>
524 <indexterm><primary>parameter entities</primary>
525   <secondary>*.inclusion</secondary></indexterm>
526 <indexterm><primary>parameter entities</primary>
527   <secondary>*.exclusion</secondary></indexterm>
528 <indexterm><primary sortas="inclusion parameter entity">*.inclusion parameter entities</primary></indexterm>
529 <indexterm><primary sortas="exclusion parameter entity">*.exclusion parameter entities</primary></indexterm>
531 These parameter entities control the inclusion and exclusion
532 markup in element declarations.
533 </para>
534 <para>Changing these declarations allows you to make global changes to
535 the inclusions and exclusions in the &DTD;.
536 </para>
537 </listitem>
538 </varlistentry>
539 <varlistentry><term><sgmltag class="paramentity">local.*</sgmltag></term>
540 <listitem>
541 <para>
542 <indexterm><primary>local parameter entities</primary></indexterm>
544 The <sgmltag class="paramentity">local.*</sgmltag> parameter
545 entities are a local extension mechanism.  You can add markup to most
546 entity declarations simply by declaring the appropriate local
547 parameter entity.
548 </para>
549 </listitem>
550 </varlistentry>
551 </variablelist>
552 </sect2>
553 </sect1>
554 <sect1 id="ch05-genstruct"><title>The General Structure of<?lb?>Customization Layers</title>
555 <para>
556 <indexterm><primary>customizing</primary>
557   <secondary>DocBook DTD</secondary>
558     <tertiary>structure (customization layers)</tertiary></indexterm>
559 Although customization layers vary in complexity, most of them 
560 have the same general structure as other customization layers of
561 similar complexity.
562 </para>
563 <para>
564 In the most common case, you probably want to include the entire &DTD;, but you
565 want to make some small changes.  These customization layers tend
566 to look like this:
567 </para>
568 <screenco>
569 <areaspec>
570 <area id="gs-o1" coords="1 1" units="linecolumn"/>
571 <area id="gs-d1" coords="3 1" units="linecolumn"/>
572 <area id="gs-n1" coords="6 1" units="linecolumn"/>
573 </areaspec>
574 <screen>
575  <replaceable>Overrides of Entity Declarations Here</replaceable>
577  &lt;!ENTITY % orig-docbook "-//OASIS//DTD DocBook V3.1//EN">
578  %orig-docbook;
580  <replaceable>New/Modified Element and Attribute Declarations Here</replaceable>
581 </screen>
582 <calloutlist>
583 <callout arearefs="gs-o1"><para>
584 Declare new values for parameter entities
585 (<sgmltag class='paramentity'>local.*</sgmltag>,
586 <sgmltag class='paramentity'>*.element</sgmltag>, 
587 <sgmltag class='paramentity'>*.attlist</sgmltag>)
588 that you wish to modify.
589 </para></callout>
590 <callout arearefs="gs-d1"><para>
591 Include the entire DocBook &DTD; by parameter entity reference.
592 <indexterm><primary>parameter entities</primary>
593   <secondary>DocBook DTD, including by reference</secondary></indexterm>
595 </para></callout>
596 <callout arearefs="gs-n1"><para>
597 Add new element and attribute declarations for any elements that you
598 added to the &DTD;.
599 <indexterm><primary>elements</primary>
600   <secondary>declarations</secondary>
601     <tertiary>adding for new</tertiary></indexterm>
602 <indexterm><primary>attributes</primary>
603   <secondary>declarations</secondary>
604     <tertiary>adding for new</tertiary></indexterm>
605 </para></callout>
606 </calloutlist>
607 </screenco>
608 <para>
609 <indexterm><primary>modules</primary>
610   <secondary>DocBook customization</secondary></indexterm>
612 In slightly more complex customization layers, the changes that you
613 want to make are influenced by the interactions between modules. In
614 these cases, rather than including the whole &DTD; at once, you
615 include each of the modules separately, perhaps with entity or element
616 declarations between them:
617 </para>
618 <screen>
619 <replaceable>Overrides of Most Entity Declarations Here</replaceable>
621 &lt;!ENTITY % orig-pool "-//OASIS//ELEMENTS DocBook Information Pool V3.1//EN">
622 %orig-pool;
624 <replaceable>Overrides of Document Hierarchy Entities Here</replaceable>
626 &lt;!ENTITY % orig-hier "-//OASIS//ELEMENTS DocBook Document Hierarchy V3.1//EN">
627 %orig-hier;
629 <replaceable>New/Modified Element and Attribute Declarations Here</replaceable>
631 &lt;!ENTITY % orig-notn "-//OASIS//ENTITIES DocBook Notations V3.1//EN">
632 %orig-notn;
634 &lt;!ENTITY % orig-cent "-//OASIS//ENTITIES DocBook Character Entities V3.1//EN">
635 %orig-cent;
637 &lt;!ENTITY % orig-gen  "-//OASIS//ENTITIES DocBook Additional General Entities V3.1//EN">
638 %orig-gen;
639 </screen>
640 <para>
641 <indexterm><primary>one-off customizations</primary></indexterm>
643 Finally, it's worth noting that in the rare case in which you
644 need certain kinds of very simple, <quote>one-off</quote>
645 customizations, you can do them in the document subset:
646 </para>
647 <screen>
648 &lt;!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V3.1//EN" [
649 <replaceable>Overrides of Entity Declarations Here</replaceable>
650 <replaceable>New/Modified Element and Attribute Declarations Here</replaceable>
652 &lt;book>...&lt;/book>
653 </screen>
654 </sect1>
655 <sect1 id="ch05-write"><title>Writing, Testing, and Using a Customization Layer</title>
656 <para>
657 <indexterm><primary>DocBook DTD</primary>
658   <secondary>customizing</secondary>
659     <tertiary>customization layers, writing, testing, and using</tertiary></indexterm>
660 <indexterm><primary>customizing</primary>
661   <secondary>DocBook DTD</secondary>
662     <tertiary>writing, testing and using customization layers</tertiary></indexterm>
663 The procedure for creating, testing, and using a customization layer
664 is always about the same. In this section, we'll go through the
665 process in some detail. The rest of the sections in this chapter
666 describe a range of useful customization layers.
667 </para>
668 <sect2><title>Deciding What to Change</title>
669 <para>
670 If you're considering writing a customization layer, there must be
671 something that you want to change. Perhaps you want to add an element
672 or attribute, remove one, or change some other aspect of the &DTD;.
673 </para>
674 <para>
675 <indexterm><primary>inline elements</primary>
676   <secondary>adding</secondary></indexterm>
678 Adding an element, particularly an inline element, is one possibility.
679 If you're writing documentation about an object-oriented system, you
680 may have noticed that DocBook provides <sgmltag>ClassName</sgmltag> but not
681 <sgmltag>MethodName</sgmltag>. Suppose you want to add
682 <sgmltag>MethodName</sgmltag>?
683 </para>
684 </sect2>
685 <sect2><title>Deciding How to Change a Customization Layer</title>
686 <para>
687 <indexterm><primary>customizing</primary>
688   <secondary>DocBook DTD</secondary>
689     <tertiary>changing customization layers</tertiary></indexterm>
690 Figuring out what to change may be the hardest part of the process.
691 The organization of the parameter entities is quite logical, and,
692 bearing in mind the organization described in <xref linkend="s-dbstruct"/>, finding something similar usually
693 provides a good model for new changes.
694 </para>
696 <para condition="online">
697 <indexterm><primary>parameter entities</primary>
698   <secondary>reference (online)</secondary></indexterm>
700 Two online resources may be useful. First, the 
701 <link linkend="ref-parement">parameter entity reference section</link> of the
702 online book provides more detail than the print version. Second, there
703 is an alternate version of the book online that shows all of the element
704 content models in terms of the parameter entities that define them, 
705 rather than the <quote>flattened</quote> versions shown here.
706 </para>
708 <para condition="online">
709 <indexterm><primary>elements</primary>
710   <secondary>content models (online reference)</secondary></indexterm>
711 One resource that may be useful is the alternate version of this
712 book that shows all of the element content models in
713 terms of the parameter entities which define them, rather than
714 the <quote>flattened</quote> versions shown here. The alternate version
715 is on the <acronym>CD-ROM</acronym> and online at the book web site:
716 <ulink url="http://docbook.org/">http://docbook.org/</ulink>.
717 </para>
719 <para>
720 <sgmltag>MethodName</sgmltag> is similar to <sgmltag>ClassName</sgmltag>, so
721 <sgmltag>ClassName</sgmltag> is probably a good model.  <sgmltag>ClassName</sgmltag>
722 is an inline element, not a hierarchy element, so it's in
723 <filename>dbpool.mod</filename>. Searching for <quote>classname</quote> in
724 <filename>dbpool.mod</filename> reveals:
725 </para>
726 <screen>
727 &lt;!ENTITY % local.tech.char.class "">
728 &lt;!ENTITY % tech.char.class
729         "Action|Application|<emphasis role="bold">ClassName</emphasis>|Command|ComputerOutput
730         |Database|Email|EnVar|ErrorCode|ErrorName|ErrorType|Filename
731         |Function|GUIButton|GUIIcon|GUILabel|GUIMenu|GUIMenuItem
732         |GUISubmenu|Hardware|Interface|InterfaceDefinition|KeyCap
733         |KeyCode|KeyCombo|KeySym|Literal|Constant|Markup|MediaLabel
734         |MenuChoice|MouseButton|MsgText|Option|Optional|Parameter
735         |Prompt|Property|Replaceable|ReturnValue|SGMLTag|StructField
736         |StructName|Symbol|SystemItem|Token|Type|UserInput|VarName
737         %local.tech.char.class;">
738 </screen>
739 <para>
740 Searching further reveals the element and attribute declarations for
741 <sgmltag>ClassName</sgmltag>.
742 </para>
743 <para>
744 <indexterm><primary>local.tech.char.class parameter entity</primary></indexterm>
745 <indexterm><primary>tech.char.class parameter entity</primary></indexterm>
746 It would seem (and, in fact, it is the case) that adding
747 <sgmltag>MethodName</sgmltag> can be accomplished by adding it to the local
748 extension mechanism for <sgmltag class="paramentity">tech.char.class</sgmltag>, namely <sgmltag class="paramentity">local.tech.char.class</sgmltag>, and adding element and
749 attribute declarations for it. A customization layer that does this
750 can be seen in <xref linkend="ex-addmethodname"/>.
751 <indexterm><primary>MethodName, adding with customization layer</primary></indexterm>
753 </para>
754 <example id="ex-addmethodname">
755 <title>Adding MethodName with a Customization Layer</title>
756 <programlisting>
757 &lt;!ENTITY % local.tech.char.class "|MethodName">     <co id="add.methname.1"/>
759 &lt;!-- load DocBook -->                               <co id="add.methname.2"/>
760 &lt;!ENTITY % DocBookDTD PUBLIC "-//OASIS//DTD DocBook V3.1//EN">
761 %DocBookDTD;
763 &lt;!ELEMENT MethodName - - ((%smallcptr.char.mix;)+)  <co id="add.methname.3"/>>
764 &lt;!ATTLIST MethodName                                <co id="add.methname.4"/>
765         %common.attrib;
766         %classname.role.attrib;
767         %local.classname.attrib;
769 </programlisting>
770 <calloutlist>
771 <callout arearefs="add.methname.1"><para>Declare the appropriate
772 parameter entity (these are described in <xref linkend="dbparam"/>).
773 The declaration in your customization layer is encountered first, so
774 it overrides the definition in the DocBook &DTD; (all the local
775 classes are defined as empty in the &DTD;).</para>
776 </callout>
777 <callout arearefs="add.methname.2"><para>Use a parameter entity to
778 load the entire DocBook &DTD;.</para>
779 </callout>
780 <callout arearefs="add.methname.3"><para>Add an element declaration
781 for the new element. The content model for this element is taken
782 directly from the content model of <sgmltag>ClassName</sgmltag>.</para>
783 </callout>
784 <callout arearefs="add.methname.4"><para>Add an attribute list
785 declaration for the new element. These are the same attributes as
786 <sgmltag>ClassName</sgmltag>.
787 </para>
788 </callout></calloutlist>
789 </example>
790 </sect2>
791 <sect2><title>Using Your Customization Layer</title>
792 <para>
793 <indexterm><primary>customizing</primary>
794   <secondary>DocBook DTD</secondary>
795     <tertiary>writing, testing, and using customization layers</tertiary></indexterm>
796 <indexterm><primary>DocBook DTD</primary>
797   <secondary>customizing</secondary>
798     <tertiary>using customization layer</tertiary></indexterm>
800 In order to use the new customization layer, you must save it in a
801 file, for example <filename>mydocbk.dtd</filename>, and then you must use the
802 new &DTD; in your document.
803 </para>
804 <para>
805 The simplest way to use the new &DTD; is to point to it with a system
806 identifier:
807 <indexterm><primary>Java Math class</primary></indexterm>
808 <indexterm><primary>absolute value (numbers), computing</primary></indexterm>
809 </para>
810 <screen>
811 <![CDATA[
812 <!DOCTYPE chapter SYSTEM "/path/to/mydocbk.dtd">
813 <chapter><title>My Chapter</title>
814 <para>
815 The Java <classname>Math</classname> class provides a 
816 <methodname>abs</methodname> method to compute absolute value of a number.
817 </para>
818 </chapter>
820 </screen>
821 <para>
822 <indexterm><primary>public identifiers</primary>
823   <secondary>DocBook DTD</secondary>
824     <tertiary>customization layer</tertiary></indexterm>
825 If you plan to use your customization layer in many documents, or
826 exchange it with interchange partners, consider giving your &DTD; its
827 own public identifier, as described in <xref linkend="s-notdocbook"/>
828 </para>
829 <para>
830 <indexterm><primary>catalog files</primary>
831   <secondary>public identifier, adding</secondary></indexterm>
833 In order to use the new public identifier, you must add it to your
834 catalog:
835 <screen>
836 PUBLIC "-//Your Organization//DTD DocBook V3.1-Based Extension V1.0//EN"
837        "/share/sgml/mydocbk.dtd"
838 </screen>
839 and use that public identifier in your documents:
840 </para>
841 <screen>
842 <![CDATA[
843 <!DOCTYPE chapter 
844   PUBLIC "-//Your Organization//DTD DocBook V3.1-Based Extension V1.0//EN">
845 <chapter><title>My Chapter</title>
846 <para>
847 The Java <classname>Math</classname> class provides a 
848 <methodname>abs</methodname> method to compute absolute value of a number.
849 </para>
850 </chapter>
852 </screen>
853 <para>
854 <indexterm><primary>XML</primary>
855   <secondary>system identifiers</secondary>
856     <tertiary>URI requirements</tertiary></indexterm>
857 <indexterm><primary>URI</primary>
858   <secondary>XML system identifiers</secondary></indexterm>
859 If you're using &XML;, remember that you must provide a system
860 identifier that satisfies the requirements of a Uniform Resource
861 Identifier (<acronym>URI</acronym>).
862 </para>
863 </sect2>
864 </sect1>
865 <sect1 id="cust.test"><title>Testing Your Work</title>
866 <para>
867 <indexterm><primary>customizing</primary>
868   <secondary>DocBook DTD</secondary>
869     <tertiary>writing, testing, and using customization layers</tertiary></indexterm>
870 <indexterm><primary>testing</primary>
871   <secondary>customization layers (DocBook DTD)</secondary></indexterm>
872 <indexterm><primary>validation</primary>
873   <secondary>customization layers</secondary></indexterm>
875 &DTD;s, by their nature, contain many complex, interrelated elements.
876 Whenever you make a change to the &DTD;, it's always wise to use a
877 validating parser to double-check your work. A parser like
878 <command>nsgmls</command> from James Clark's
879 <application><acronym>SP</acronym></application> can identify elements
880 (attributes, parameter entities) that are declared but unused, as well
881 as ones that are used but undeclared.
882 </para>
883 <para>
885 A comprehensive test can be accomplished with
886 <command>nsgmls</command> using the <option>-wall</option>
887 option. Create a simple test document and run:
888 </para>
889 <screen>
890 nsgmls <co id="nsgmls.opt.1"/>-sv <co id="nsgmls.opt.2"/>-wall test.sgm
891 </screen>
892 <calloutlist>
893 <callout arearefs="nsgmls.opt.1"><para>
895 <indexterm><primary>suppressing output (parser)</primary></indexterm>
896 <indexterm><primary>versions</primary>
897   <secondary>nsgmls parser, printing number</secondary></indexterm>
899 The <option>-s</option> option
900 tells <command>nsgmls</command> to suppress its normal output (it will
901 still show errors, if there are any). The <option>-v</option> option
902 tells <command>nsgmls</command> to print its version number; this
903 ensures that you always get <emphasis>some</emphasis> output, even if
904 there are no errors.</para>
905 </callout>
906 <callout arearefs="nsgmls.opt.2"><para>
907 <indexterm><primary>errors</primary>
908   <secondary>listing, comprehensive</secondary></indexterm>
909 <indexterm><primary>warnings, listing</primary></indexterm>
910 <indexterm><primary>nsgmls parser</primary>
911   <secondary>warning types</secondary></indexterm>
913 The <option>-wall</option>
914 option tells <command>nsgmls</command> to provide a comprehensive list
915 of all errors and warnings.  You can use less verbose, and more
916 specific options instead; for example, <option>-wundefined</option> to
917 flag undefined elements or <option>-wunused-param</option> to warn you
918 about unused parameter entities. The <command>nsgmls</command>
919 documentation provides a complete list of warning types.</para>
920 </callout>
921 </calloutlist>
922 <sect2><title>DocBook <acronym>V3.1</acronym> Warnings</title>
923 <para>
924 <indexterm><primary>DocBook DTD</primary>
925   <secondary>warnings</secondary></indexterm>
926 If you run the preceding command over DocBook <acronym>V3.1</acronym>,
927 you'll discover one warning generated by the &DTD;:
928 </para>
929 <screen>
930 nsgmls:I: SP version "1.3"
931 nsgmls:cals-tbl.dtd:314:37:W: content model is mixed but does not allow #PCDATA everywhere
932 </screen>
933 <para>
934 <indexterm><primary>Entry element</primary></indexterm>
936 This is not truly an error in the &DTD;, and can safely be ignored.
937 The warning is caused by <quote>pernicious mixed content</quote> in
938 the content model of DocBook's <sgmltag>Entry</sgmltag> element.  See
939 the <sgmltag>Entry</sgmltag> reference page for a complete discussion.
940 </para>
941 </sect2>
942 </sect1>
943 <sect1 id="ch05-remvelem"><title>Removing Elements</title>
944 <para>
945 <indexterm><primary>elements</primary>
946   <secondary>removing</secondary></indexterm>
948 DocBook has a large number of elements. In some authoring
949 environments, it may be useful or necessary to remove some of these
950 elements.
951 </para>
952 <sect2><title>Removing MsgSet</title>
953 <para>
954 <indexterm><primary>MsgSet element</primary>
955   <secondary>removing</secondary></indexterm>
956 <sgmltag>MsgSet</sgmltag> is a favorite target. It has a complex
957 internal structure designed for describing interrelated error
958 messages, especially on systems that may exhibit messages from several
959 different components. Many technical documents can do without it, and
960 removing it leaves one less complexity to explain to your authors.
961 </para>
962 <para>
963 <xref linkend="ex.remvmsgset"/> shows a customization layer that removes the
964 <sgmltag>MsgSet</sgmltag> element from DocBook:
965 </para>
966 <example id="ex.remvmsgset">
967 <title>Removing MsgSet</title>
968 <programlisting>
969 &lt;!ENTITY % compound.class "Procedure|SideBar"> <co id="rmv.msgset.1"/>
970 &lt;!ENTITY % msgset.content.module "IGNORE">     <co id="rmv.msgset.2"/>
971 &lt;!-- load DocBook -->
972 &lt;!ENTITY % DocBookDTD PUBLIC "-//OASIS//DTD DocBook V3.1//EN">
973 %DocBookDTD;
974 </programlisting>
975 <calloutlist>
976 <callout arearefs="rmv.msgset.1"><para>Remove
977 <sgmltag>MsgSet</sgmltag> from the <sgmltag class="paramentity">compound.class</sgmltag>. This is the only place
978 in the &DTD; where <sgmltag>MsgSet</sgmltag> is referenced.</para>
979 </callout>
980 <callout arearefs="rmv.msgset.2"><para>Exclude the definition of
981 <sgmltag> MsgSet</sgmltag> and all of its subelements from the
982 &DTD;.</para>
983 </callout>
984 </calloutlist>
985 </example>
986 </sect2>
987 <sect2><title>Removing Computer Inlines</title>
988 <para>
989 <indexterm><primary>inline elements</primary>
990   <secondary>computer inlines, removing</secondary></indexterm>
991 <indexterm><primary>parameter entities</primary>
992   <secondary>tech.char.class, redefining</secondary></indexterm>
993 <indexterm><primary>tech.char.class parameter entity</primary>
994   <secondary>redefining</secondary></indexterm>
996 DocBook contains a large number of computer inlines. The DocBook
997 inlines define a domain-specific vocabulary.  If you're working in
998 another domain, many of them may be unnecessary. You can remove a
999 bunch of them by redefining the <sgmltag class="paramentity">tech.char.class</sgmltag> parameter entity and
1000 then excluding the declarations for the elements removed. The initial
1001 definition of <sgmltag class="paramentity">tech.char.class</sgmltag> is:
1002 </para>
1003 <screen>
1004 &lt;!ENTITY % tech.char.class
1005     "Action|Application|ClassName|Command|ComputerOutput
1006     |Database|Email|EnVar|ErrorCode|ErrorName|ErrorType|Filename
1007     |Function|GUIButton|GUIIcon|GUILabel|GUIMenu|GUIMenuItem
1008     |GUISubmenu|Hardware|Interface|InterfaceDefinition|KeyCap
1009     |KeyCode|KeyCombo|KeySym|Literal|Markup|MediaLabel|MenuChoice
1010     |MouseButton|MsgText|Option|Optional|Parameter|Prompt|Property
1011     |Replaceable|ReturnValue|SGMLTag|StructField|StructName
1012     |Symbol|SystemItem|Token|Type|UserInput
1013     %local.tech.char.class;">
1014 </screen>
1015 <para>
1016 When examining this list, it seems that you can delete all of the
1017 inlines except, perhaps, <sgmltag>Application</sgmltag>,
1018 <sgmltag>Command</sgmltag>, <sgmltag>Email</sgmltag>,
1019 <sgmltag>Filename</sgmltag>, <sgmltag>Literal</sgmltag>,
1020 <sgmltag>Replaceable</sgmltag>, <sgmltag> Symbol</sgmltag>, and
1021 <sgmltag>SystemItem</sgmltag>. The following customization layer
1022 removes them.
1023 </para>
1024 <example>
1025 <title>Removing Computer Inlines</title>
1026 <programlisting><![CDATA[
1027 <!ENTITY % tech.char.class
1028         "Application|Command|Email|Filename|Literal
1029         |Replaceable|Symbol|SystemItem">
1030 <!ENTITY % action.module "IGNORE">
1031 <!ENTITY % classname.module "IGNORE">
1032 <!ENTITY % computeroutput.module "IGNORE">
1033 <!ENTITY % database.module "IGNORE">
1034 <!ENTITY % envar.module "IGNORE">
1035 <!ENTITY % errorcode.module "IGNORE">
1036 <!ENTITY % errorname.module "IGNORE">
1037 <!ENTITY % errortype.module "IGNORE">
1038 <!--<!ENTITY % function.module "IGNORE">-->
1039 <!ENTITY % guibutton.module "IGNORE">
1040 <!ENTITY % guiicon.module "IGNORE">
1041 <!ENTITY % guilabel.module "IGNORE">
1042 <!ENTITY % guimenu.module "IGNORE">
1043 <!ENTITY % guimenuitem.module "IGNORE">
1044 <!ENTITY % guisubmenu.module "IGNORE">
1045 <!ENTITY % hardware.module "IGNORE">
1046 <!ENTITY % interface.module "IGNORE">
1047 <!ENTITY % interfacedefinition.module "IGNORE">
1048 <!--<!ENTITY % keycap.module "IGNORE">-->
1049 <!ENTITY % keycode.module "IGNORE">
1050 <!--<!ENTITY % keycombo.module "IGNORE">-->
1051 <!--<!ENTITY % keysym.module "IGNORE">-->
1052 <!ENTITY % markup.module "IGNORE">
1053 <!ENTITY % medialabel.module "IGNORE">
1054 <!ENTITY % menuchoice.module "IGNORE">
1055 <!--<!ENTITY % mousebutton.module "IGNORE">-->
1056 <!--<!ENTITY % msgtext.module "IGNORE">-->
1057 <!--<!ENTITY % option.module "IGNORE">-->
1058 <!--<!ENTITY % optional.module "IGNORE">-->
1059 <!--<!ENTITY % parameter.module "IGNORE">-->
1060 <!ENTITY % prompt.module "IGNORE">
1061 <!ENTITY % property.module "IGNORE">
1062 <!ENTITY % returnvalue.module "IGNORE">
1063 <!ENTITY % sgmltag.module "IGNORE">
1064 <!ENTITY % structfield.module "IGNORE">
1065 <!ENTITY % structname.module "IGNORE">
1066 <!ENTITY % token.module "IGNORE">
1067 <!ENTITY % type.module "IGNORE">
1068 <!ENTITY % userinput.module "IGNORE">
1069 <!-- load DocBook --> 
1070 <!ENTITY % DocBookDTD PUBLIC "-//OASIS//DTD DocBook V3.1//EN">
1071 %DocBookDTD;
1072 ]]></programlisting>
1073 </example>
1074 <para>
1075 Initially we removed several more elements from <sgmltag class="paramentity">tech.char.class</sgmltag> (<sgmltag class="paramentity">function.module</sgmltag>, <sgmltag class="paramentity">keycap.module</sgmltag>), but using the testing procedure
1076 described in <xref linkend="cust.test"/>, we discovered that
1077 these elements are used in other content models.  Because they are
1078 used in other content modules, they cannot simply be removed from the
1079 &DTD; by deleting them from <sgmltag class="paramentity">
1080 tech.char.class</sgmltag>.  Even though they can't be deleted
1081 outright, we've taken them out of most inline contexts.
1082 </para>
1083 <para>
1084 <indexterm><primary>synopses</primary>
1085   <secondary>synopsis elements, removing</secondary></indexterm>
1086 <indexterm><primary>FuncSynopsis element</primary>
1087   <secondary>removing</secondary></indexterm>
1088 <indexterm><primary>CmdSynopsis element</primary>
1089   <secondary>removing</secondary></indexterm>
1090 It's likely that a customization layer that removed this many
1091 technical inlines would also remove some larger technical structures
1092 (<sgmltag>MsgSet</sgmltag>, <sgmltag>FuncSynopsis</sgmltag>), which
1093 allows you to remove additional elements from the &DTD;.
1094 </para>
1095 </sect2>
1096 <sect2>
1097 <title>Removing Synopsis Elements</title>
1098 <para>
1099 Another possibility is removing the complex Synopsis elements. The
1100 customization layer in <xref linkend="ex.remvcmdsyn"/> removes
1101 <sgmltag>CmdSynopsis</sgmltag> and <sgmltag>FuncSynopsis</sgmltag>.
1102 </para>
1103 <example id="ex.remvcmdsyn">
1104 <title>Removing CmdSynopsis and FuncSynopsis</title>
1105 <programlisting><![CDATA[
1106 <!ENTITY % synop.class "Synopsis">
1107 <!-- Instead of "Synopsis|CmdSynopsis|FuncSynopsis %local.synop.class;" -->
1109 <!ENTITY % funcsynopsis.content.module "IGNORE">
1110 <!ENTITY % cmdsynsynopsis.content.module "IGNORE">
1112 <!-- load DocBook --> 
1113 <!ENTITY % DocBookDTD PUBLIC "-//OASIS//DTD DocBook V3.1//EN">
1114 %DocBookDTD;
1115 ]]></programlisting>
1116 </example>
1117 <para>
1118 <indexterm><primary>parameter entities</primary>
1119   <secondary>empty</secondary></indexterm>
1121 Completely removing all Synopsis elements would require a more
1122 extensive customization. You can't make any of the <sgmltag class="paramentity">*.class</sgmltag> parameter entities completely empty
1123 without changing all of the parameter entities that use them. See
1124 <xref linkend="sect.remv.synop.class"/>.
1125 </para>
1126 </sect2>
1127 <sect2>
1128 <title>Removing Sectioning Elements</title>
1129 <para>
1130 <indexterm><primary>sections</primary>
1131   <secondary>elements, removing</secondary></indexterm>
1133 Perhaps you want to restrict your authors to only three levels of
1134 sectioning.  To do that, you must remove the <sgmltag>Sect4</sgmltag>
1135 and <sgmltag>Sect5 </sgmltag> elements, as shown in <xref linkend="ex.remvsect4"/>.
1136 </para>
1137 <example id="ex.remvsect4">
1138 <title>Removing <sgmltag>Sect4</sgmltag> and <sgmltag>Sect5</sgmltag> Elements
1139 </title>
1140 <programlisting><inlinegraphic fileref="examples/remv.sect4.dtd" format="linespecific"></inlinegraphic></programlisting>
1141 </example>
1142 <para>
1143 In order to completely remove an element that isn't in the information
1144 pool, it is usually necessary to redefine the elements that include
1145 it. In this case, because we're removing the <sgmltag>Sect4</sgmltag>
1146 element, we must redefine the <sgmltag>Sect3</sgmltag> element that
1147 uses it.
1148 </para>
1149 </sect2>
1150 <sect2 id="s2-remvadmon"><title>Removing Admonitions from Table Entries</title>
1151 <para>
1152 <indexterm><primary>modules</primary>
1153   <secondary>redeclarations</secondary></indexterm>
1154 <indexterm><primary>redeclarations</primary>
1155   <secondary>modules</secondary></indexterm>
1157 All of the customization layers that we've examined so far have been
1158 fairly straightforward. This section describes a much more complex
1159 customization layer. Back in <xref linkend="db-modules"/> we
1160 mentioned that several additional modules existed for
1161 <quote>redeclaration.</quote> The customization layer developed in this
1162 section cannot be written without them.
1163 </para>
1164 <para>
1165 <indexterm><primary>admonitions</primary>
1166   <secondary>removing from table entries</secondary></indexterm>
1167 <indexterm><primary>table entries, removing admonitions</primary></indexterm>
1169 The goal is to remove admonitions (<sgmltag>Warning</sgmltag>,
1170 <sgmltag>Caution</sgmltag>, <sgmltag>Note</sgmltag>) from table
1171 entries.
1172 </para>
1173 <para>
1174 <xref linkend="ex.remvadmon.1"/> is a straightforward, and incorrect, attempt.
1175 <example id="ex.remvadmon.1">
1176 <title>Removing Admonitions (First Attempt: Incorrect)</title>
1177 <programlisting role="ERROR"><![CDATA[
1178 <!-- THIS CUSTOMIZATION LAYER CONTAINS ERRORS -->
1179 <!ENTITY % tabentry.mix
1180         "%list.class;
1181         |%linespecific.class;
1182         |%para.class;        |Graphic
1183         %local.tabentry.mix;">
1184 <!-- load DocBook -->
1185 <!ENTITY % DocBookDTD PUBLIC "-//OASIS//DTD DocBook V3.1//EN">
1186 %DocBookDTD;
1187 ]]></programlisting>
1188 </example>
1189 Because the parameter entity <sgmltag class="paramentity">tabentry.mix</sgmltag> defines the mixture of elements
1190 allowed in table entries, you should remove admonitions.
1191 <indexterm><primary>parameter entities</primary>
1192   <secondary>tabentry.mix (removing admonitions)</secondary></indexterm>
1193 <indexterm><primary>tabentry.mix element, editing</primary></indexterm>
1195 </para>
1196 <para>
1197 If you attempt to parse this &DTD;, you'll find that the declaration
1198 of <sgmltag class="paramentity">tabentry.mix</sgmltag> contains errors. While
1199 you can redefine parameter entities, you cannot make reference to
1200 entities that have not been defined yet, so the use of <sgmltag class="paramentity">list.class</sgmltag>, <sgmltag class="paramentity">linespecific.class</sgmltag>, and so on, aren't allowed.
1201 </para>
1202 <para>
1203 Your second attempt might look like <xref linkend="ex.remvadmon.2"/>.
1204 <example id="ex.remvadmon.2">
1205 <title>Removing Admonitions (Second Attempt: Incorrect)</title>
1206 <programlisting role="ERROR"><![CDATA[
1207 <!-- THIS CUSTOMIZATION LAYER DOESN'T WORK -->
1208 <!-- load DocBook -->
1209 <!ENTITY % DocBookDTD PUBLIC "-//OASIS//DTD DocBook V3.1//EN">
1210 %DocBookDTD;
1211 <!ENTITY % tabentry.mix
1212         "%list.class;
1213         |%linespecific.class;
1214         |%para.class;        |Graphic
1215         %local.tabentry.mix;">
1216 ]]></programlisting>
1217 </example>
1218 Declaring <sgmltag class="paramentity">tabentry.mix</sgmltag> after the &DTD;
1219 has been loaded removes the errors.
1220 </para>
1221 <para>
1222 This example contains no errors, but it also doesn't have any effect.
1223 Remember, only the first entity declaration counts, so the declaration
1224 of <sgmltag class="paramentity">tabentry.mix</sgmltag> in
1225 <filename>dbpool.mod</filename> is the one used, not your
1226 redeclaration.
1227 </para>
1228 <para>
1229 <indexterm><primary>placeholders, redeclarations</primary></indexterm>
1230 <indexterm><primary>redeclarations</primary>
1231   <secondary>placeholders</secondary></indexterm>
1233 The only way to fix this problem is to make use of one of the redeclaration
1234 placeholders in DocBook.
1235 </para>
1236 <para>
1237 Redeclaration placeholders are spots in which you can insert
1238 definitions into the middle of the &DTD;. There are four redeclaration
1239 placeholders in DocBook:
1240 <indexterm><primary>%rdbmods parameter entity</primary></indexterm>
1242 <variablelist>
1243 <varlistentry><term><sgmltag class="paramentity">rdbmods</sgmltag></term>
1244 <listitem>
1245 <para>Inserted in <filename>docbook.dtd</filename>, between
1246 <filename>dbpool.mod</filename> and
1247 <filename>dbhier.mod</filename>. This placeholder is controlled by the
1248 <sgmltag class="paramentity">intermod.redecl.module</sgmltag> marked
1249 section.</para>
1250 </listitem>
1251 </varlistentry>
1252 <varlistentry><term><sgmltag class="paramentity">rdbpool</sgmltag></term>
1253 <listitem>
1254 <para>
1255 <indexterm><primary>%rdbpool.mod parameter entity</primary></indexterm>
1257 Inserted in the middle of <filename>dbpool.mod</filename>,
1258 between the <sgmltag class="paramentity">*.class</sgmltag> and <sgmltag class="paramentity">*.mix</sgmltag> entity declarations. This placeholder is
1259 controlled by the <sgmltag class="paramentity">dbpool.redecl.module</sgmltag>
1260 marked section.</para>
1261 </listitem>
1262 </varlistentry>
1263 <varlistentry><term><sgmltag class="paramentity">rdbhier</sgmltag></term>
1264 <listitem>
1265 <para>
1266 <indexterm><primary>%rdbhier parameter entity</primary></indexterm>
1268 Inserted in the middle of <filename>dbhier.mod</filename>,
1269 between the <sgmltag class="paramentity">*.class</sgmltag> and <sgmltag class="paramentity">*.mix</sgmltag> entity declarations. This placeholder is
1270 controlled by the <sgmltag class="paramentity">dbhier.redecl.module</sgmltag> marked
1271 section.</para>
1272 </listitem>
1273 </varlistentry>
1274 <varlistentry><term><sgmltag class="paramentity">rdbhier2</sgmltag></term>
1275 <listitem>
1276 <para>Also inserted into <filename>dbhier.mod</filename>, after the
1277 <sgmltag class="paramentity">*.mix</sgmltag> entity declarations. This
1278 placeholder is controlled by the <sgmltag class="paramentity">dbhier.redecl2.module</sgmltag> marked
1279 section.</para>
1280 </listitem>
1281 </varlistentry>
1282 </variablelist></para>
1283 <para>Use the redeclaration placeholder that it occurs nearest to, but
1284 before the entity that you want to redeclare. In our case, this is
1285 <sgmltag class="paramentity">rdbpool</sgmltag>, as seen in <xref linkend="ex.remvadmon.3"/>.
1286 <example id="ex.remvadmon.3">
1287 <title>Removing Admonitions (Third Attempt: Correct, if confusing)</title>
1288 <programlisting><![CDATA[
1289 <!ENTITY % dbpool.redecl.module "INCLUDE">
1290 <!ENTITY % rdbpool
1291 '<!ENTITY % local.tabentry.mix "">
1292 <!ENTITY % tabentry.mix
1293         "&#37;list.class;
1294         |&#37;linespecific.class;
1295         |&#37;para.class;        |Graphic
1296         &#37;local.tabentry.mix;">'>
1298 <!-- load DocBook -->
1299 <!ENTITY % DocBookDTD PUBLIC "-//OASIS//DTD DocBook V3.1//EN">
1300 %DocBookDTD;
1301 ]]></programlisting>
1302 </example>
1303 </para>
1304 <para>
1305 <indexterm><primary>escape sequences (parameter entities)</primary></indexterm>
1307 <xref linkend="ex.remvadmon.3"/> uses numeric character entity
1308 references to escape the <literal>%</literal> signs in the entity
1309 declarations and nests an entity declaration in another parameter
1310 entity. All of this is perfectly legal, but a bit confusing.  A
1311 clearer solution, and the only practical solution if you're doing
1312 anything more than a single redeclaration, is to place the new
1313 declarations in another file and include them in your customization
1314 layer by reference, like this:
1315 </para>
1316 <example id="ex.remvadmon.4">
1317 <title>Removing Admonitions (Fourth Attempt: Correct)</title>
1318 <para>In your customization layer:</para>
1319 <programlisting><![CDATA[
1321 <!ENTITY % dbpool.redecl.module "INCLUDE">
1322 <!ENTITY % rdbpool SYSTEM "rdbpool.mod">
1324 <!-- load DocBook -->
1325 <!ENTITY % DocBookDTD PUBLIC "-//OASIS//DTD DocBook V3.1//EN">
1326 %DocBookDTD;
1328 ]]></programlisting>
1329 <para>In <filename>rdbpool.mod</filename>:</para>
1330 <programlisting><![CDATA[<!ENTITY % local.tabentry.mix "">
1331 <!ENTITY % tabentry.mix
1332         "%list.class;
1333         |%linespecific.class;
1334         |%para.class;        |Graphic
1335         %local.tabentry.mix;">]]></programlisting>
1336 </example>
1337 </sect2>
1338 <sect2 id="sect.remv.synop.class">
1339 <title>Removing an Entire Class</title>
1340 <para>
1341 <indexterm><primary>classes</primary>
1342   <secondary>removing entire class</secondary></indexterm>
1343 <indexterm><primary>elements</primary>
1344   <secondary>removing</secondary></indexterm>
1345 <indexterm><primary>parameter entities</primary>
1346   <secondary>empty classes, redefining for</secondary></indexterm>
1348 Perhaps the modification that you want to make is to completely remove
1349 an entire class of elements. (If you have no need for synopsis
1350 elements of any sort, why not remove them?) In order to remove an
1351 entire class of elements, you must not only redefine the class as
1352 empty, but you must also redefine all of the parameter entities that
1353 use that class. The customization layer below completely removes the
1354 <sgmltag class="paramentity"> synop.class</sgmltag> from DocBook. It
1355 requires a customization layer, shown in <xref linkend="ex.remvclass"/>, that includes both a redeclaration module in
1356 <filename>dbpool.mod</filename> and a redeclaration module in
1357 <filename>dbhier.mod</filename>.
1358 <indexterm><primary>%synop.class, removing</primary></indexterm>
1359 </para>
1360 <example id="ex.remvclass">
1361 <title>Removing <sgmltag class="paramentity">synop.class</sgmltag></title>
1362 <para>In the customization layer:</para>
1363 <programlisting><inlinegraphic fileref="examples/remv.synop.class.dtd" format="linespecific"></inlinegraphic></programlisting>
1364 <para>In <filename>remv.synop.class.rdbpool.mod</filename>:</para>
1365 <programlisting><inlinegraphic fileref="examples/remv.synop.class.rdbpool.mod" format="linespecific"></inlinegraphic></programlisting>
1366 <para>In <filename>remv.synop.class.rdbhier.mod</filename>:</para>
1367 <programlisting><inlinegraphic fileref="examples/remv.synop.class.rdbhier.mod" format="linespecific"></inlinegraphic></programlisting>
1368 </example>
1369 </sect2>
1370 </sect1>
1371 <sect1 id="ch05-remvattr">
1372 <title>Removing Attributes</title>
1373 <para>Just as there may be more elements than you need, there may be more
1374 attributes.</para>
1375 <sect2>
1376 <title>Removing an Attribute</title>
1377 <para>
1378 <indexterm><primary>attributes</primary>
1379   <secondary>removing</secondary></indexterm>
1380 <indexterm><primary>RenderAs attribute, removing</primary></indexterm>
1382 Suppose you want to remove the <sgmltag class="attribute">RenderAs</sgmltag> attribute from the
1383 <sgmltag>Sect1</sgmltag> element. <sgmltag class="attribute">RenderAs</sgmltag> allows the author to
1384 <quote>cheat</quote> in the presentation of hierarchy by specifying
1385 that the stylesheet should render a <sgmltag>Sect1</sgmltag> as
1386 something else: a <sgmltag>Sect3</sgmltag>, perhaps. <xref linkend="ex.remvrendas"/> details the removal of <sgmltag class="attribute">RenderAs</sgmltag>.
1387 </para>
1388 <example id="ex.remvrendas">
1389 <title>Removing RenderAs from Sect1</title>
1390 <programlisting>
1391 &lt;!ENTITY % sect1.module "IGNORE">                <co id="remvattr.1"/>
1393 &lt;!-- load DocBook -->                            <co id="remvattr.2"/>
1394 &lt;!ENTITY % DocBookDTD PUBLIC "-//OASIS//DTD DocBook V3.1//EN">
1395 %DocBookDTD;
1397 &lt;!ENTITY % local.sect1.attrib "">                <co id="remvattr.3"/>
1398 &lt;!ENTITY % sect1.role.attrib "%role.attrib;">    <co id="remvattr.4"/>
1399 &lt;!ELEMENT Sect1 - O (Sect1Info?, (%sect.title.content;), (%nav.class;)*,  <co id="remvattr.5"/>
1400         (((%divcomponent.mix;)+, 
1401         ((%refentry.class;)* | Sect2* | SimpleSect*))
1402         | (%refentry.class;)+ | Sect2+ | SimpleSect+), (%nav.class;)*)
1403         +(%ubiq.mix;)>
1404 &lt;!ATTLIST Sect1                                  <co id="remvattr.6"/>
1405         %label.attrib;
1406         %status.attrib;
1407         %common.attrib;
1408         %sect1.role.attrib;
1409         %local.sect1.attrib;
1411 </programlisting>
1412 </example>
1413 <calloutlist>
1414 <callout arearefs="remvattr.1"><para>Turn off the
1415 <sgmltag>Sect1</sgmltag> module so that the element and attribute
1416 declarations in the &DTD; will be ignored.
1417 </para>
1418 </callout>
1419 <callout arearefs="remvattr.2"><para>Include the DocBook &DTD;.</para>
1420 </callout>
1421 <callout arearefs="remvattr.3"><para>By keeping the local attribute
1422 declaration, we leave open the possibility of a simple customization
1423 layer on top of our customization layer.</para>
1424 </callout>
1425 <callout arearefs="remvattr.4"><para>Similarly, we keep the
1426 parameterized definition of the <sgmltag class="attribute">Role</sgmltag>
1427 attribute.</para>
1428 </callout>
1429 <callout arearefs="remvattr.5"><para>We're changing the attribute
1430 list, not the element, so we've simply copied the
1431 <sgmltag>Sect1</sgmltag> element declaration from the DocBook
1432 &DTD;.</para>
1433 </callout>
1434 <callout arearefs="remvattr.6"><para>Finally, we declare the attribute
1435 list, leaving out the <sgmltag class="attribute">RenderAs</sgmltag>.</para>
1436 </callout>
1437 </calloutlist>
1438 </sect2>
1439 <sect2><title>Subsetting the Common Attributes</title>
1440 <para>
1441 <indexterm><primary>attributes</primary>
1442   <secondary>common</secondary>
1443     <tertiary>subsetting</tertiary></indexterm>
1444 <indexterm><primary>subsetting common attributes</primary></indexterm>
1446 DocBook defines eleven common attributes; these attributes appear on
1447 <emphasis>every</emphasis> element. Depending on how you're
1448 processing your documents, removing some of them can both simplify the
1449 authoring task and improve processing speed.
1450 </para>
1451 <para>Some obvious candidates are:</para>
1452 <variablelist>
1453 <varlistentry><term>Effectivity attributes (<sgmltag class="attribute">Arch
1454 </sgmltag>, <sgmltag class="attribute">OS</sgmltag>,...)</term>
1455 <listitem>
1456 <para>
1457 <indexterm><primary>effectivity attributes, removing</primary></indexterm>
1459 If you're not using all of the effectivity attributes in your
1460 documents, you can get rid of up to seven attributes in one fell
1461 swoop.</para>
1462 </listitem>
1463 </varlistentry>
1464 <varlistentry><term><sgmltag class="attribute">Lang</sgmltag></term>
1465 <listitem>
1466 <para>
1467 <indexterm><primary>Lang attribute</primary>
1468   <secondary>removing</secondary></indexterm>
1470 If you're not producing multilingual documents, you can remove
1471 <sgmltag class="attribute">Lang</sgmltag>.</para>
1472 </listitem>
1473 </varlistentry>
1474 <varlistentry><term><sgmltag class="attribute">Remap</sgmltag></term>
1475 <listitem>
1476 <para>
1477 <indexterm><primary>Remap attribute</primary>
1478   <secondary>removing</secondary></indexterm>
1479 The <sgmltag class="attribute">Remap</sgmltag> attribute is
1480 designed to hold the name of a semantically equivalent construct from
1481 a previous markup scheme (for example, a Microsoft Word style template
1482 name, if you're converting from Word).  If you're authoring from
1483 scratch, or not preserving previous constructs with <sgmltag class="attribute">Remap</sgmltag>, you can get rid of it.</para>
1484 </listitem>
1485 </varlistentry>
1486 <varlistentry><term><sgmltag class="attribute">XrefLabel</sgmltag></term>
1487 <listitem>
1488 <para>
1489 <indexterm><primary>XrefLabel attribute</primary>
1490   <secondary>removing</secondary></indexterm>
1491 If your processing system isn't using <sgmltag class="attribute">XrefLabel</sgmltag>, it's a candidate as
1492 well.</para>
1493 </listitem>
1494 </varlistentry>
1495 </variablelist>
1496 <para>
1497 The customization layer in <xref linkend="ex.remvcommon"/> reduces the
1498 common attributes to just <sgmltag class="attribute">ID</sgmltag> and
1499 <sgmltag class="attribute">Lang</sgmltag>.
1500 </para>
1501 <example id="ex.remvcommon">
1502 <title>Removing Common Attributes</title>
1503 <programlisting><![CDATA[<!ENTITY % common.attrib
1504 "ID   ID    #IMPLIED
1505  Lang CDATA #IMPLIED"
1507 <!ENTITY % idreq.common.attrib
1508 "ID   ID    #REQUIRED
1509  Lang CDATA #IMPLIED"
1511 <!-- load DocBook -->
1512 <!ENTITY % DocBookDTD PUBLIC "-//OASIS//DTD DocBook V3.1//EN">
1513 %DocBookDTD;]]></programlisting>
1514 </example>
1515 <para>
1516 <indexterm><primary>common.attrib parameter entity</primary></indexterm>
1517 <indexterm><primary>idreq.common.attrib parameter entity</primary></indexterm>
1519 By definition, whatever attributes you define in the <sgmltag class="paramentity">common.attrib</sgmltag> and <sgmltag class="paramentity">idreq.common.attrib</sgmltag> parameter entities
1520 are the common attributes. In <filename>dbpool.mod </filename>, these
1521 parameter entities are defined in terms of other parameter entities,
1522 but there's no way to preserve that structure in your customization
1523 layer.
1524 </para>
1525 </sect2>
1526 </sect1>
1527 <sect1 id="ch05-addelem"><title>Adding Elements: Adding a Sect6</title>
1528 <para>
1529 <indexterm><primary>elements</primary>
1530   <secondary>adding</secondary></indexterm>
1532 Adding a structural (as opposed to information pool) element generally
1533 requires adding its name to a class and then providing the appropriate
1534 definitions. <xref linkend="ex.addsect6"/> extends DocBook by adding a
1535 <sgmltag>Sect6</sgmltag> element.
1536 </para>
1537 <example id="ex.addsect6">
1538 <title>Adding a Sect6 Element</title>
1539 <programlisting><![CDATA[<!ENTITY % sect5.module "IGNORE">
1540 <!ENTITY % DocBookDTD PUBLIC "-//OASIS//DTD DocBook V3.1//EN">
1541 %DocBookDTD;
1542 <!-- Add Sect6 to content model of Sect5 -->
1543 <!ENTITY % sect5.role.attrib "%role.attrib;">
1544 <!ELEMENT Sect5 - O (Sect5Info?, (%sect.title.content;), (%nav.class;)*,
1545         (((%divcomponent.mix;)+, 
1546                 ((%refentry.class;)* | Sect6* | SimpleSect*))
1547         | (%refentry.class;)+ | Sect6+ | SimpleSect+), (%nav.class;)*)>
1548 <!ATTLIST Sect5
1549         %label.attrib;
1550         %status.attrib;
1551         %common.attrib;
1552         %sect5.role.attrib;
1554 <!ENTITY % sect6.role.attrib "%role.attrib;">
1555 <!ELEMENT Sect6 - O (Sect6Info?, (%sect.title.content;), (%nav.class;)*,
1556         (((%divcomponent.mix;)+, ((%refentry.class;)* | SimpleSect*))
1557         | (%refentry.class;)+ | SimpleSect+), (%nav.class;)*)>
1558 <!ATTLIST Sect6
1559         %label.attrib;
1560         %status.attrib;
1561         %common.attrib;
1562         %sect6.role.attrib;
1563 >]]></programlisting>
1564 </example>
1565 <para>
1566 Here we've redefined <sgmltag>Sect5</sgmltag> to include
1567 <sgmltag>Sect6</sgmltag> and provided a declaration for
1568 <sgmltag>Sect6</sgmltag>. Note that we didn't bother to provide
1569 <sgmltag class="attribute">RenderAs</sgmltag> attributes in our
1570 redefinitions. To properly support <sgmltag>Sect6</sgmltag>, you might
1571 want to redefine all of the sectioning elements so that <literal>
1572 Sect6</literal> is a legal attribute value for <sgmltag class="attribute">RenderAs</sgmltag>.
1573 </para>
1574 </sect1>
1575 <sect1 id="ch05-classrole"><title>Other Modifications: Classifying a Role</title>
1576 <para>
1577 <indexterm><primary>Role attribute</primary>
1578   <secondary>changing on Procedure (example)</secondary></indexterm>
1580 The <sgmltag class="attribute">Role</sgmltag> attribute, found on almost
1581 all of the elements in DocBook, is a <literal>CDATA</literal> attribute that
1582 can be used to subclass an element. In some applications, it may be useful
1583 to modify the definition of <sgmltag class="attribute">Role</sgmltag> so that
1584 authors must choose one of a specific set of possible values.</para>
1585 <para>In <xref linkend="ex.changerole"/>, <sgmltag class="attribute">Role</sgmltag> on the <sgmltag>Procedure</sgmltag> element
1586 is constrained to the values <literal>Required</literal> or <literal>
1587 Optional</literal>.</para>
1588 <example id="ex.changerole">
1589 <title>Changing Role on Procedure</title>
1590 <programlisting><![CDATA[<!ENTITY % procedure.role.attrib "Role (Required|Optional) #IMPLIED">
1591 <!-- load DocBook -->
1592 <!ENTITY % DocBookDTD PUBLIC "-//OASIS//DTD DocBook V3.1//EN">
1593 %DocBookDTD;]]><indexterm startref="DocBookcustomch05" class="endofrange"/><indexterm startref="customDocBookch05" class="endofrange"/></programlisting>
1594 </example>
1595 </sect1>
1596 </chapter>