How To Build a New Custom Tag Set

The Concept

The basic idea for a new Tag Set is that all lower-level elements (paragraphs, lists, figures, etc.) will be defined in modules — either the modules of the base Suite or in new Tag-Set-specific modules rather than in the DTD itself. The new DTD will be fairly short and include only definitions of the topmost elements, at least the document element and maybe its children.

Modules are declared using external parameter entities in the Suite’s Module to Name the Modules or in the Tag-Set-specific Module of Modules. Modules are referenced in the DTD proper, in the order needed to define the parameter entities in sequence.

This Book Tag Set was written as an example of the new best-practice customization technique. A new variant Tag Set that follows this plan will probably consist of the following modules:

Making a Variant Tag Set

To show the process, here is a series of instructions for making a new Tag Set, illustrated by showing how the Book Tag Set was created using the modules of the complete Tag Suite.

  1. Modules — Write a new Tag-Set-specific Module of Modules, which defines all new customization modules the Tag Set needs. As an example, the Book Tag Set created the module %bookcustom-modules.ent;, which contains the definitions of the class-override module %bookcustom-classes.ent;, the mix-override module %bookbcustom-mixes.ent;, and the models-override module %bookcustom-models.ent;.
  2. Class overrides — Write a Tag-Set-specific class-override module, defining any overrides to the Suite classes. These classes are defined in the default classes module, %default-classes.ent;. As an example, the Book Tag Set created the module %bookcustom-classes.ent;, in which several new models, including %book-part.class; and %sec-back.class;, were declared.
  3. Mix overrides — Write a Tag-Set-specific mix-override module, defining any overrides to the Suite mixes. These mixes are defined in the default mixes module, %default-mixes.ent;. As an example, the Book Tag Set created the module %bookcustom-mixes.ent;, in which override mixes such as %emphasized-text; and %just-rendition; were declared.
  4. Model overrides — Create a Tag-Set-specific content-model-override module, defining any overrides to the content models and attribute lists for the Suite. As an example, the Book Tag Set created the module %bookcustom-models.ent;, in which element collections (suffixed “-elements”) that will be mixed with #PCDATA were redefined, full content models overrides (suffixed “-model”) were redefined, and some new attributes and attribute lists were added.
  5. New Elements — Write any new element modules needed. These will define any new block-level or phrase-level elements. For the Book Tag Set, the new module %book-meta-model; defines book-specific metadata.
  6. DTD Module — With those modules in place, construct a new DTD module. Within that module:
    • Use an external parameter entity Declaration to name and then call the Tag-Set-specific modules of modules, for the Book Tag Set, the module %book-modules.ent;.
    • Use an external parameter entity Declaration to name and then call the Suite Modules of Modules, which names all the potential modules, for the Book Tag Set, the module %bookcustom-modules.ent;.
    • Use an external parameter entity reference to call the Tag-Set-specific class overrides, for the Book Tag Set, the module %bookcustom-classes.ent;.
    • Use an external parameter entity reference to call the Suite default classes, for the Book Tag Set, the module %default-classes.ent;.
    • Use an external parameter entity reference to call the Tag-Set-specific mix overrides, for the Book Tag Set, the module %bookbcustom-mixes.ent;.
    • Use an external parameter entity reference to call the Suite default mixes, for the Book Tag Set, the module %default-mixes.ent;.
    • Use an external parameter entity reference to call the Tag-Set-specific content models and attribute list overrides, for the Book Tag Set, the module %bookcustom-models.ent;.
    • Use an external parameter entity reference to call in the standard Common Module (%common.ent;) that defines elements and attributes so common they are used by many modules.
    • Use an external parameter entity reference to call any new Tag-Set-specific module defining new block-level or phrase-level elements. For the Book Tag Set, there are several modules, for example, %bookmeta.ent; for book-specific metadata and %bookpart.ent; that defines book parts such as chapters.
    • Select, from the Module of Modules, those modules which contain the elements needed for the Tag Set, for example, selecting lists and not selecting math elements, and calling in each of the modules needed. The Book Tag Set calls these in alphabetical order, since the order does not matter.
    • Define the document element (<book>) and any other unique elements and entities needed for this DTD. The Book Tag Set declares only a few elements — <book> [the top-level element] and its potential components: <book-meta>, <book-front>, <body>, and <back>.