How is the @audience attribute used for conditional processing?

The @audience attribute in DITA is used for conditional processing, allowing content creators to specify the target audience for a particular piece of content. This attribute helps tailor content to different user groups or audiences, ensuring that readers receive information that is relevant to their needs.

Conditional processing in DITA

Conditional processing in DITA involves the inclusion or exclusion of content based on specific criteria. The @audience attribute is one of the key attributes used for conditional processing. It allows content creators to mark content with the intended audience or user group.

Employing the @audience attribute

Employing the @audience attribute requires attribute value assignment, conditional processing rules. These are influenced by publishing output.

Attribute Value Assignment

The @audience attribute is assigned a value that represents the target audience or user group. This value is typically a keyword or label that describes the audience, such as “beginner,” “intermediate,” “advanced,” or specific user roles like “developer” or “administrator.” Content creators can also assign multiple @audience values to the same element by separating them with spaces. This allows content to be targeted at multiple audience segments simultaneously.

Conditional Processing Rules

Conditional processing rules are defined in a DITA map or within a specialization schema. These rules specify conditions for including or excluding content based on the values of attributes like @audience.

Publishing Output

Publishing Output: When generating output from DITA content, the publishing system or tool applies the defined conditional processing rules. Content with @audience values that match the specified conditions is included in the output, while content that doesn’t match is excluded.

Example

A DITA document describes a software application’s features. Different features may have different levels of complexity, and so the document must provide user-specific information.


        <feature>
            <title>Feature A</title>
            <description audience="beginner">
                This feature is easy to use for beginners.
            </description>
            <description audience="intermediate">
                Intermediate users will find this feature very useful.
            </description>
            <description audience="advanced">
                Advanced users can leverage the full power of this feature.
            </description>
        </feature>
    

Example:

The <feature> element describes a software feature.

The <description> elements provide descriptions tailored to different audiences: “beginner,” “intermediate,” and “advanced.”

The @audience attribute is used to specify the target audience for each description.