Can DITA maps contain conditional processing instructions?

DITA maps can contain conditional processing instructions, enabling authors to specify conditions under which certain content should be included or excluded in the output. Conditional processing instructions allow for content variations based on factors like audience, product versions, or delivery formats.

Using Conditional Processing Instructions in DITA Maps

DITA maps support conditional processing instructions, which are essential for content customization and flexibility.

Conditional Processing Instructions (Conrefs)

Conditional processing instructions, often referred to as “conrefs” (conditional references), are used to specify conditions that determine whether specific content should be included or excluded when generating output from a DITA map. These conditions can be based on various factors, such as the target audience, product versions, or delivery formats. Authors can use attributes like conref, conkeyref, and conaction to implement conditional processing. The conref attribute references a conditional topic or section, conkeyref associates conditions with specific keys, and conaction determines whether the content is included or excluded based on the conditions. By using these instructions, authors can tailor content for different scenarios. For example, in a DITA map for software documentation, conditional processing could be used to display specific instructions for different operating systems or product editions.

Example

A DITA map uses the conref attribute to apply conditional processing.


<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
<map>
  <title>User Guide</title>
  <topicref href="introduction.dita" />
  <topicref href="installation.dita">
    <data conref="installation-windows.dita" conaction="exclude" />
  </topicref>
  <topicref href="operation.dita" />
</map>
    

In this example:

  • The DITA map has a title, “User Guide.”
  • It includes references to DITA topics such as “introduction.dita” and “operation.dita.”
  • The <topicref> element for “installation.dita” contains a conref attribute that references a conditional topic, “installation-windows.dita.” The conaction attribute is set to “exclude,” indicating that when generating output, the content from “installation-windows.dita” should be excluded unless specific conditions are met. This condition could be related to the target operating system, ensuring that the content is only included for Windows users, while other users see the default “installation.dita” content.