Can conditional processing be applied to multimedia elements in DITA?

Conditional processing can be applied to multimedia elements in DITA, allowing control over when and where multimedia content, such as images, audio, or video, is displayed or excluded in the final output based on specific conditions. This is particularly useful when different versions of multimedia content are required for various outputs or audiences.

Condition Attributes:

DITA allows applying condition attributes, similar to text content, to multimedia elements within topics.

These condition attributes are typically used to mark multimedia content, indicating its relevance or applicability under specific conditions.

Output Filtering:

Conditional processing for multimedia elements is closely tied to the concept of output filtering in DITA.

Output filtering tools or processes decide which multimedia content should be included or excluded from the final output based on the specified conditions.

Example:

A DITA-based product documentation that includes screenshots for different versions of a software application (e.g., Basic, Pro, and Premium) requires separate documentation sets for each software version.

Condition Attributes in DITA:


  <p>This is a screenshot of the application in the Pro version.</p>
  <image href="screenshot-pro.png" conkeyref="product-version=pro" />

  <p>This is a screenshot of the application in the Premium version.</p>
  <image href="screenshot-premium.png" conkeyref="product-version=premium" />
  

In this example, conditions are applied to the images based on the product-version key.

Output Filtering and Multimedia:


  <map>
    <topicmeta>
      <keywords>
        <keyword keyname="product-version" keyscope="local">
          <keyword keyref="basic" conaction="exclude" />
          <keyword keyref="pro" conaction="exclude" />
        </keyword>
      </keywords>
    </topicmeta>
  </map>
  

In this map, it is specified that for one output (e.g., Pro version documentation), topics marked with conaction=”exclude” for the product-version=pro condition should be excluded. Similarly, the same can be defined for other versions, like Premium.

With this setup, when generating documentation for the Pro version, the output filtering process will exclude images marked for other versions, ensuring that users only see multimedia content relevant to their version.