Was this helpful?
Example: Constrain attributes for the section element
In this scenario, an information architect wants to redefine the attributes for the section element. He wants to make the id attribute required and omit the spectitle attribute.
1. He creates a .mod file named idRequiredSectionContraint.mod, where "idRequired" is a string that characterizes the constraint.
2. He adds the following content to idRequiredSectionContraint.mod:
<!-- ============================================================= -->
<!-- CONSTRAINED TOPIC ENTITIES -->
<!-- ============================================================= -->

<!ENTITY section-constraints
"(topic idRequired-section-c)"
>

<!-- Declares the entities referenced in the constrained content -->
<!-- model. -->
<!ENTITY % conref-atts
'conref CDATA #IMPLIED
conrefend CDATA #IMPLIED
conaction (mark|pushafter|pushbefore|pushreplace|-dita-use-conref-target) #IMPLIED
conkeyref CDATA #IMPLIED' >
<!ENTITY % filter-atts
'props CDATA #IMPLIED
platform CDATA #IMPLIED
product CDATA #IMPLIED
audience CDATA #IMPLIED
otherprops CDATA #IMPLIED
%props-attribute-extensions;' >
<!ENTITY % select-atts
'%filter-atts;
base CDATA #IMPLIED
%base-attribute-extensions;
importance (default|deprecated|high|low|normal|obsolete|optional|
recommended|required|urgent|-dita-use-conref-target) #IMPLIED
rev CDATA #IMPLIED
status (changed|deleted|unchanged|-dita-use-conref-target) #IMPLIED' >
<!ENTITY % localization-atts
'translate (no|yes|-dita-use-conref-target) #IMPLIED
xml:lang CDATA #IMPLIED
dir (lro|ltr|rlo|rtl|-dita-use-conref-target) #IMPLIED' >

<!-- Declares the constrained content model. Original definition -->
<!-- included %univ-atts;, spectitle, and outputclass; now includes-->
<!-- individual pieces of univ-atts, to make ID required. -->

<!ENTITY % section.attributes
"id CDATA #REQUIRED
%conref-atts;
%select-atts;
%localization-atts;
outputclass CDATA #IMPLIED">
Note: The information architect had to declare all the parameter entities that are referenced in the redefined attributes for section. If he did not do so, none of the attributes that are declared in the conref-atts, select-atts, or localization-atts parameter entities would be available on the section element. Furthermore, since the select-atts parameter entity references the filter-atts parameter entity, the filter-atts must be declared and it must precede the declaration for the select-atts parameter entity. The props-attribute-extensions and base-attribute-extensions parameter entities do not need to be declared in the constraint module, because they are declared in the document-type shells before the inclusion of the constraint module.
3. He then integrates the constraint module into the applicable document-type shells and adds it to his catalog.xml file.