Can DITA topics contain both conditional and non-conditional text?

DITA topics can indeed contain both conditional and non-conditional text. This flexibility allows authors to blend content that is common to all audiences with content that varies based on conditions, improving content reuse and adaptability.

DITA topics can indeed contain both conditional and non-conditional text. This flexibility allows authors to blend content that is common to all audiences with content that varies based on conditions, improving content reuse and adaptability. DITA topics provide authors with the flexibility to mix both conditional and non-conditional text, enabling the creation of comprehensive and adaptable content. Within a DITA topic, authors can intersperse regular content that is relevant to all audiences with content that is conditionally specific to particular scenarios. This flexibility is achieved by using the <flag> element for conditional text and standard elements for non-conditional content.

Example

The majority of the content in a software manual is applicable to all users, but some sections are meant for advanced users only.


<p>This is non-conditional content for all users.</p>
    

In the same topic, authors can include conditional content using <flag> elements for advanced users.


<flag audience="advanced">
  <p>This is advanced content for expert users.</p>
</flag>
    

To determine when and how this conditional content is included in the output, conditions are defined in the DITAVAL file, as described in a previous response. By mixing both types of content within a single topic, content authors maintain a clear and organized structure, avoid content duplication, and ensure content adaptability. It is essential to carefully structure the topic so that it remains coherent and understandable for all users.

This principle carries over into more complex documentation as well.


<p>This is a general introduction for all users.</p>

<flag audience="advanced">
  <p>This is an advanced topic for expert users.</p>
</flag>

<p>Here's more content for all users.</p>

<flag product="pro">
  <p>This feature is available in the Pro version.</p>
</flag>
    

In this example, there is a mix of general content, content for advanced users, and content specific to the “Pro” product version. The conditions defined in the DITAVAL file would determine how the output adapts to the selected audience or product version.