DITA Grammar Customization
Eliot Kimber · Balisage series on markup technologies · 2019
The Darwin Information Typing Architecture (DITA) standard defines a layered extension mechanism, "specialization", for defining grammars such that the element types and attributes in any conforming DITA grammar are explicitly mapped back to one or more "base" types, with the lowest base type being the type defined in the core DITA grammar. This means that any conforming DITA document can be processed in terms of the base types of the document's elements and attributes, irrespective of how specialized the elements and attributes themselves are. The architecture itself depends only on the use of a DITA-defined attribute ( @class ), where the value is normally set as a default in the grammar. The DITA standard defines conventions for DTD and RELAX NG grammar modules that enable re-use of the declarations for base types when defining new types or constraining existing types and makes customizing content models about as easy as it can be. The DITA standard defines three types of customization: "configuration", "constraint", and "specialization". Configuration combines existing grammar modules in the context of a top-level "shell" grammar to define a unique DITA document type without directly defining or modifying any element type or attribute declarations. Constraints modify existing element type or attribute declarations to make them more constrained (such as disallowing specific elements) but does not add new element types or attributes. Specialization defines new element types or attributes. For DITA DTDs, customization is done through parameter entities and references to individual grammar modules. For DITA RNGs, customization is done through declaration or overriding of patterns. The DITA Technical Committee maintains tooling for generating conforming DITA DTDs from conforming DITA RNGs.