Topic Constraint Module Tutorial
Goal: Define a topic constraint module that limits the content of <p>
to just character data and a few inline element types.
Constraint modules allow you to adjust the content models and attribute lists of individual elements in any vocabulary module. The primary rule is that your changes must be at least as constrained as the base content model or attribute list, meaning that your constraints cannot allow anything that is not allowed by the base element type or attribute.
- Remove optional elements
- Change repeating groups into sequences or (with XSD schemas) limit the number of repeats.
- Remove optional attributes
- Limit the set of values a keyword-valued element or attribute may take (as long as the list allows any required values).
In general the base DITA content models are very loose in order to allow maximum flexibility in specialization. This leaves you a lot of room for constraint.
In this tutorial the constraint module limits the content of <p>
elements
within topics to a small set of inline elements: <b>
(bold),
<i>
(italic), and <u>
(underline).1
For both DTD and XSD the task is the same: find the appropriate parameter entity (DTD)
or group (XSD) that defines the base content model for <p>
and redefine it to reflect the constrained content model.
The constraint module is then integrated into the document type shells that need to impose these constraints.