Chapter 4. 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 used by a given document type. 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.

This means you can do any of the following:

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.

1 This example was suggested by Casey Jordan who asked on the DITA Users' list about how to implement this type of constraint using XSD schema.