<enumerationdef>
An enumeration definition is a binding of an attribute to a set of controlled values. The set of controlled values can be limited to a specific element or it could be empty.
Usage information
An enumeration definition can accomplish the following goals:
- Bind a set of controlled values to an attribute
- When the
<enumerationdef>
element contains only an<attributedef>
and a<subjectdef>
element, the set of controlled values that are bound to the attribute apply to all elements. For example, when<enumerationdef>
contains only<attributedef name="value"/>
, the@value
attribute is limited to the specified enumeration for all elements that can specify the@value
attribute. - Limit a set of controlled values to a specific element and attribute pair
- When the
<enumerationdef>
element contains an<attributedef>
, a<subjectdef>
, and an<elementdef>
element, the enumeration applies to the specified attribute only on the specified element. The enumeration does not apply to the attribute on other elements.For example, when the
<enumerationdef>
element contains both<attributedef name="type"/>
and<elementdef name="note"/>
, only the@type
attribute on the<note>
element is limited to the specified enumeration. The possible values for the@type
attribute on other elements are not affected. - Specify the default value for an attribute or element and attribute pair
- When the
<enumerationdef>
element contains a<defaultSubject>
element, processors operate as if the value specified by the<defaultSubject>
element is explicitly set in the DITA source and the XML grammar does not set a default value for the attribute.For example, given the following
<enumerationdef>
element, if no value is set for the@audience
attribute on<draft-comment>
in the DITA source, processors operate as if the @audience attribute is explicitly set to spec-editors:<subjectScheme> <!-- ... --> <enumerationdef> <elementdef name="draft-comment"/> <attributedef name="audience"/> <subjectdef keyref="values-audience-draft-comment"/> <defaultSubject keyref="spec-editors"/> </enumerationdef> <!-- ... --> </subjectScheme>
- Specify that an attribute is not valid.
When the
<enumerationdef>
element contains a@subjectdef
element that does not reference a subject, no value is valid for the attribute.For example, the following code sample specifies that no tokens are valid for the
@props
attribute:<subjectScheme> <!-- ... --> <enumerationdef> <attributedef name="props"/> <subjectdef/> </enumerationdef> <!-- ... --> </subjectScheme>
Specialization hierarchy
The <enumerationdef>
element is specialized from
<topicref>
. It is defined in the subject scheme
module.
Processing expectations
Attributes
The following attributes are available on this element: ID
and conref attributes, @base
, @class
, @outputclass
, and @status
.
Example
The following code sample contains three enumeration definitions:
<subjectScheme>
<!-- DEFINE SETS OF CONTROLLED VALUES -->
<!-- 1. Values for @audience on <draft-comment> -->
<subjectdef keys="values-audience-draft-comment">
<subjectdef keys="spec-editors"/>
<subjectdef keys="tc-reviewers"/>
</subjectdef>
<!-- 2. Values for @otherprops -->
<subjectdef keys="values-otherprops">
<subjectdef keys="examples"/>
</subjectdef>
<!-- BINDS SETS OF CONTROLLED VALUES -->
<!-- 1. Binding for @audience on <draft-comment> -->
<enumerationdef>
<elementdef name="draft-comment"/>
<attributedef name="audience"/>
<subjectdef keyref="values-audience-draft-comment"/>
<defaultSubject keyref="spec-editors"/>
</enumerationdef>
<!-- 2. Binding for @otherprops -->
<enumerationdef>
<attributedef name="otherprops"/>
<subjectdef keyref="values-otherprops"/>
</enumerationdef>
<!-- 3. Binding for @props -->
<enumerationdef>
<attributedef name="props"/>
<subjectdef/>
</enumerationdef>
</subjectScheme>
- The permissible values for the
@audience
attribute on the<draft-comment>
element are restricted to the subject values-audience-draft-comment. This means that the only allowed values are spec-editors and tc-reviewers. If no value for@audience
is specified for a<draft-comment>
element in the DITA source, it is assumed to be set to spec-editors. - The permissible values for
@otherprops
are restricted to the subject values-otherprops. This means that the only valid value for@otherprops
is examples. - The enumeration for the
@props
attribute contains a<subjectdef>
element that does not reference a subject. That means that no values are valid for the@props
attribute.