Can notes be conditionally processed in DITA content?

In DITA, notes, such as warnings, tips, and important information, can be conditionally processed using attributes like @outputclass or @props. This allows content creators to control the visibility of notes in different output formats or under specific conditions.

DITA provides a mechanism for conditionally processing content based on various factors, including output formats (e.g., HTML, PDF) or specific situations (e.g., different product versions). This mechanism can be applied to notes to control when they are displayed or excluded from the output.

Several ways to conditionally process notes include using the @outputclass attribute and using the @props attribute.

Using @outputclass Attribute:

The @outputclass attribute is commonly used to assign specific conditions to elements. Content creators can define different output conditions using this attribute and then control the display of notes based on these conditions.

For example, two different output classes can be defined: print and online. In the DITA source, the @outputclass attribute is assigned to notes accordingly. During publishing, a print version can be generated where only print-specific notes are displayed, and an online version where online-specific notes are displayed.

Using @props Attribute:

The @props attribute can also be used for conditional processing. Content creators can define custom properties that represent different conditions or scenarios and assign them to notes.

For example, a custom property product-version may be defined with possible values like “v1.0” and “v2.0”. In the notes, the @props attribute is assigned based on the applicable product version. During publishing, notes can be conditionally included for a specific product version.

Example:

The following DITA content features conditional processing of notes:


<p>This is an important concept for all users.

<!-- Conditional note for the "print" output --> <note outputclass="print"> <p>Important: This concept must be emphasized in print materials.</p> </note> <!-- Conditional note for the "online" output --> <note outputclass="online"> <p>Note: For online documentation, users can refer to more details on the website.</p> </note> <!-- Conditional note based on product version --> <note props="product-version(v1.0)"> <p>For users of Product Version 1.0: Follow these specific instructions.</p> </note>

In this example, notes are conditionally processed based on the specified conditions (@outputclass or @props). During publishing, which notes to include in the output can be chosen based on the intended output format or product version.