How can DITA support conditional processing at the element level?

DITA XML offers robust support for conditional processing at the element level, enabling content creators to control the visibility and inclusion of specific elements based on various conditions or attributes. This flexibility is invaluable when authoring content that needs to adapt to different scenarios, products, or audiences.

Conditional Attributes

In DITA, you can use conditional attributes to specify the conditions under which an element should be included in the output. Common conditional attributes include “conkeyref,” “conref,” and “props.” These attributes allow you to link to or reference content from other topics and conditionally include or exclude that content. This is particularly useful for reusing information across multiple documents while ensuring it’s contextually relevant.


Here’s an example of how conditional processing at the element level works in DITA XML:

  <cmd>If you encounter any issues, <ph conkeyref="troubleshooting_tip"/> for assistance.</cmd>

<topic id="troubleshooting_tip">
  <title>Troubleshooting Tip</title>
    <p>If the problem persists, contact our support team for help.</p>
  <props outputclass="productA"/>

In this example, the “conkeyref” attribute is used to reference the “troubleshooting_tip” topic within a step element. Depending on the “outputclass” attribute’s value (in this case, “productA”), the content of the referenced topic may be included or excluded in the final output.