2.5.5.2 Constraint rules

There are certain rules that apply to the design and implementation of constraints.

Contribution to the @domains attribute
Each constraint that is integrated into a DITA document type MUST be declared in the @domains attribute for each structural type that is integrated into the document type. For DTDs, the contribution for the @domains attribute is specified in the constraint module file; for XSD and RELAX NG, the contribution to the @domains attribute is specified directly in the document type shell.
Content model
The content model for a constrained element must be at least as restrictive as the unconstrained content model for the element.

The content model and attributes of an element can be constrained by only one constraint module. If two constraint modules exist that constrain the content model or attributes for a specific element, those two modules must be replaced with a new constraint module that reflects the aggregation of the two original constraint modules.

Domain constraints
When a domain module is integrated into a document-type shell, the base domain element can be omitted from the domain extension group or parameter entity. In such a case, there is no separate constraint declaration, because the content model is configured directly in the document-type shell.

A domain module can be constrained by only one constraint module. This means that all restrictions for the extension elements that are defined in the domain must be contained within that one constraint module.

Structural constraints
Each constraint module can constrain elements from only one vocabulary module. For example, a single constraint module that constrains <refsyn> from reference.mod and constrains <context> from task.mod is not allowed. This rule maintains granularity of reuse at the module level.

Constraint modules that restrict different elements from within the same vocabulary module can be combined with one another. Such combinations of constraints on a single vocabulary module have no meaningful order or precedence.

Return to main page.