How is conditional processing controlled for reused content in DITA?

Conditional processing in DITA allows controlling the inclusion or exclusion of content based on specific conditions. When reusing content in DITA, conditional processing can be applied to ensure that the reused content adapts to different contexts or scenarios.

Controlling conditional processing in reused DITA topics involves conditional attributes and processing conditions.

Conditional Attributes:

Conditional processing in DITA is primarily managed through conditional processing attributes, such as “conref,” “conkeyref,” and “props” (short for “properties”).

These attributes are applied to elements or topics to specify conditions under which they should be processed or displayed.

Conditional Processing Conditions:

Conditions are user-defined criteria used to control content processing.

Conditions can be based on a variety of factors, such as audience, product version, output format, or any other relevant aspect of the documentation.

Example of Conditional Processing:

A DITA topic about a software feature is shared across different products with variations. Content specific to each product needs to be selectively included when reusing the topic.


<topic id="software-feature">
    <title>Software Feature</title>
    <body>
        <section conkeyref="product-specific-info" conref="path/to/software-feature.dita"/>
    </body>
</topic>

Conditional Processing for Product-Specific Content:

For product-specific content, conditional attributes can be used:


<topic id="product-x-specific">
    <title>Product X-specific Information</title>
    <body>
        <section conkeyref="software-feature" conref="path/to/software-feature.dita">
            <props outputclass="product-x"/>
        </section>
    </body>
</topic>

<topic id="product-y-specific">
    <title>Product Y-specific Information</title>
    <body>
        <section conkeyref="software-feature" conref="path/to/software-feature.dita">
            <props outputclass="product-y"/>
        </section>
    </body>
</topic>

In this example:

  • The <props> element with the “outputclass” attribute is used to apply conditional processing.
  • “product-x” and “product-y” are output class values used as conditions.

The content of the reused topic (software feature) can be controlled based on the output class attribute. Content specific to “Product X” or “Product Y” is included while hiding the irrelevant parts.