##### 24.4.6.4 Specifying attribute values for a block element or parent

For attributes of block elements, you can do the following:

Assign block element attributes

Override block element attributes

Assign interpolated parent attributes

Override interpolated parent attributes

When you want to override default or assigned attributes, keep in mind:

Where to use DITAAttribute markers

Assign block element attributes

To apply attributes (other than id) to a block element (other than <xref>), assign attribute="value" pairs, separated by spaces, to the paragraph format(s) mapped to the element:

    [DITAParaAttributes]
    ; para format (wildcards OK) = attributes
    ParaFmt = attribute1="value1" attribute2="value2" ...

You can use DITA2Go macros for any part of the assignment, or even for the entire assignment. For example:

    [DITAParaAttributes]
    ParaFmt = <$MacroToWriteAttrs>

Override block element attributes

To override a setting in [DITAParaAttributes] or to override default attributes for a particular instance of a block element, place a DITAAttribute PI marker in a paragraph mapped to the element, with content as follows:

    elementname: attribute1="value1" attribute2="value2" ...

For example:

    linklist: role="friend" type="reference"

The name of the element must be followed by a colon. Separate attribute="value" pairs with a space. Each value must be enclosed in double quotes. You can use DITA2Go macros for everything after the colon.

Assign interpolated parent attributes

To assign attributes to an interpolated parent of a block element:

    [DITAParentAttributes]
    ; para format (wildcards OK) = parentname: attributes
    ParaFmt = parentname: attribute1="value1" attribute2="value2" ...

You can use DITA2Go macros for the assignment.

Override interpolated parent attributes

To override a setting in [DITAParentAttributes] or to override default attributes for an interpolated parent of a block element, place a DITAAttribute PI marker in a paragraph mapped to the element, with content as follows:

    parentname: attribute1="value1" attribute2="value2" ...

To apply attributes to more than one interpolated parent, use a separate marker for each parent.

Where to use DITAAttribute markers

Use DITAAttribute PI markers only to supply attribute values other than the DTD default values for an element, or to override attribute values specified in a configuration file. Do not use DITAAttribute PI markers for any of the following:

- The id attribute of the current element; use a DITAElemID PI markermarker instead. See §24.4.6.1 Specifying a value for the id attribute.
- The id attribute of an interpolated parent of the current element; use a DITAParentID PI marker instead. See §24.4.6.1 Specifying a value for the id attribute.
- Any <xref> element attributes; use DITALink* PI markers instead. See §24.9.5 Overriding <xref> attribute values.

A DITAAttribute PI marker overrides settings in [DITAParaAttributes] and [DITAParentAttributes], but does not override settings in [DITACharAttributes] (see §24.4.6.5 Specifying attribute values for an inline element) or [TableAttributes] (see §24.6 Specifying options for tables in DITA XML).

Previous Topic: 24.4.6.3 Specifying attribute values for the root element of a topic

Next Topic: 24.4.6.5 Specifying attribute values for an inline element

Parent Topic: 24.4.6 Assigning attributes to DITA elements

Sibling Topics:

24.4.6.1 Specifying a value for the id attribute

24.4.6.2 Including an id attribute in every element

24.4.6.3 Specifying attribute values for the root element of a topic

24.4.6.5 Specifying attribute values for an inline element

24.4.6.6 Providing outputclass attributes for all elements