How are attributes defined in DITA specialization?

Attributes in DITA are defined through a combination of predefined attributes and custom attributes created in DITA specializations.

Attributes Categories

Attributes fall under two categories: predefined and custom.

Predefined Attributes:

DITA provides a set of predefined attributes as part of the DITA standard. These attributes serve specific purposes and can be applied to elements within DITA documents.

Predefined attributes are often prefixed with “@” and have well-defined meanings and use cases. Some common predefined attributes include:

  • @id: Used to provide a unique identifier for an element within a DITA document.
  • @class: Allows elements to be categorized or classified, often used for styling, conditional processing, or providing metadata.
  • @outputclass: Specifies the styling or formatting of an element in output formats.
  • @audience: Indicates the target audience for a piece of content.
  • @product: Specifies the product or version of a product to which the content is relevant.
  • @props: Allows the specification of conditional processing attributes and values.

Custom Attributes:

Organizations can define custom attributes in DITA specializations to meet specific content or domain requirements. These attributes extend the predefined set of attributes.

Custom attributes are typically defined in the DITA specialization schema, which can be a DTD (Document Type Definition) or an XML Schema.

When defining custom attributes, content creators specify the following:

  • Attribute Name: The name of the custom attribute.
  • Attribute Type: The data type or format of the attribute’s value (e.g., text, number, date).
  • Default Value: An optional default value that is automatically assigned to the attribute if no explicit value is provided in the content.
  • Usage Guidelines: Instructions or guidelines on how the attribute should be used.

Attribute Usage

In either case, using attributes involves application and values.

Attribute Application:

Once defined, attributes can be applied to elements within DITA documents. This involves associating an attribute with a specific element or elements.

Attributes are applied by including them as part of the element’s markup. For example:

        <elementname attribute="value">Content</elementname>

The attribute name (e.g., attribute) is followed by an equals sign and the attribute value (e.g., “value”).

Attribute Values:

Attributes can have different types of values, including plain text, numbers, dates, and references to other elements or resources.

The allowed values and constraints for attributes are defined in the DITA standard or within specialization schemas.

For example, an attribute might be constrained to accept only specific values or follow certain formatting rules.


An organization specializes DITA for documenting different software products. They define a custom attribute called @product-version to specify the version of each documented software product. The specialization schema might look like this:

        <!-- DITA Specialization Schema -->
                <attribute name="product-version" type="text" default="1.0">
                    <desc>Specifies the version of the software product.</desc>

In this example, the organization defines the @product-version custom attribute with a default value of “1.0.” Authors can then apply this attribute to specific elements in their DITA content to specify the product version.