DTD: Coding requirements for element-configuration modules
This section is non-normative.
Element-configuration modules (constraint and expansion) have specific coding requirements.
The tagname.attributes
parameter
entity
When the attribute list for an
element is constrained or expanded, there is a declaration of the
tagname.attributes
parameter entity that defines the modified attributes.
Example
This section is non-normative.
The following list provides examples for both constraint and expansion modules:
- Constraint module
-
The following parameter entity defines a constrained attributes list for the
<note>
element that removes most of the values defined for@type
. It also removes@othertype
:<!ENTITY % note.attributes "type (attention | caution | note ) #IMPLIED %univ-atts;">
The following parameter entity restricts the highlighting domain to
<b>
and<i>
:<!ENTITY % HighlightingDomain-c-ph "b | i" >
- Expansion module
-
The following parameter entity defines a new attribute intended for use with various table elements:
<!ENTITY % cellPurposeAtt-d-attribute-expansion "cell-purpose (sale | out-of-stock | new | last-chance | inherit | none) #IMPLIED" >
For expansion modules, note the following considerations.
The tagname.attributes
parameter entity can be defined in an attribute-specialization
module, or it can be defined directly in the expansion module.
The tagname.content
parameter entity
When the content model for an element is constrained or expanded, there is a
declaration of the tagname.content
parameter
entity that defines the modified content model.
Example
This section is non-normative.
The following list provides examples for both constraint and expansion modules:
- Constraint module
-
The following parameter entity defines a more restricted content model for
<topic>
, in which the<shortdesc>
element is required.<!ENTITY % topic.content "((%title;), (%shortdesc;), (%prolog;)?, (%body;)?, (%topic-info-types;)*)" >
Note that replacing a base element with domain extensions is a form of constraint that can be accomplished directly in the document-type shell. No constraint module is required.
In the following example, the<pre>
base type is removed from the entity declaration, effectively allowing specializations of<pre>
but not<pre>
itself.<!ENTITY % pre "%pr-d-pre; | %sw-d-pre; | %ui-d-pre;">
- Expansion module
-
The redefinition of the content model references the parameter entity that was defined in the element-specialization module.
The following code sample shows the entity declaration file for an element-specialization module that defines a
<section-shortdesc>
element, which is intended to be added to the content model of<section>
:<!ENTITY % section-shortdesc "section-shortdesc">
When the content model for
<section>
is redefined in the expansion module, it references the parameter entity defined in the entities file for the element specialization:<!ENTITY % section.content "(#PCDATA | %dl; | %div; | %fig; | %image; | %note; | %ol; | %p; | %simpletable; | %ul; | %title; | %draft-comment;| %sectionShortdesc;)*" >
Note that this expansion module also constrains the content model of
<section>
to only include certain block elements.