Attribute generalization

DITA provides a syntax to generalize attributes that have been specialized from the @props or @base attribute.

Specialization-aware processors MUST process both the specialized and generalized forms of an attribute as equivalent in their values.

When a specialized attribute is generalized to an ancestor attribute, the value of the ancestor attribute consists of the name of the specialized attribute followed by its specialized value in parentheses.

For example, if @jobrole is an attribute specialized from @person, which in turn is specialized from @props:

  • jobrole="programmer" can be generalized to person="jobrole(programmer)" or to props="jobrole(programmer)"
  • props="jobrole(programmer)" can be respecialized to person="jobrole(programmer)" or to jobrole="programmer"

In this example, processors performing generalization and respecialization can use the @specializations attribute to determine the ancestry of the specialized @jobrole attribute, and therefore the validity of the specialized @person attribute as an intermediate target for generalization.

If more than one attribute is generalized, the value of each is separately represented in this way in the value of the ancestor attribute.

Generalized attributes are typically not expected to be authored or edited directly. They are used by processors to preserve the values of the specialized attributes during the time or in the circumstances in which the document is in a generalized form.

A single element MUST NOT contain both generalized and specialized values for the same attribute.

For example, the following <p> element provides two values for the @jobrole attribute, one in a generalized syntax and the other in a specialized syntax:

<p person="jobrole(programmer)" jobrole="admin">
    <!-- ... -->
</p>

This is an error condition, since it means the document has been only partially generalized, or that the document has been generalized and then edited using a specialized document type.