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