What is the relationship between conditions and output filtering in DITA?
In DITA, conditions and output filtering are closely related concepts, as both are used to control what content is included in the final output. Conditions are used to mark content, while output filtering determines which marked content should be included or excluded based on specific criteria.
Conditions in DITA:
Conditions are attributes applied to elements and topics within DITA content.
These attributes are typically used to mark content with specific labels or keywords, indicating its status or relevance in different contexts.
Conditions allow for defining what should be included or excluded in the content for specific outputs or audiences.
Output Filtering in DITA:
Output filtering refers to the process of controlling what content is rendered in the final output, such as a PDF, HTML, or other formats.
It is achieved by specifying filtering criteria, typically based on the conditions applied to the content.
Output filtering tools or processes, often provided by DITA publishing systems or tools, decide which content to include or exclude based on these criteria.
Example:
A DITA-based user manual for a software application includes content for both Windows and macOS users, and separate manuals for each platform are to be generated.
Conditions:
<p>For Windows users.</p>
<p conkeyref="platform=windows">This feature is available on Windows.</p>
<p conkeyref="platform=macos">This feature is available on macOS.</p>
In this example, conditions are applied to content based on the platform key.
Output Filtering:
<map>
<topicmeta>
<keywords>
<keyword keyname="platform" keyscope="local">
<keyword keyref="windows" conaction="exclude" />
<keyword keyref="macos" conaction="exclude" />
</keyword>
</keywords>
</topicmeta>
</map>
In this map, it is defined that for one output (e.g., Windows manual), topics marked with conaction=”exclude” for the platform=windows condition should be excluded. Similarly, for another output (e.g., macOS manual), topics with conaction=”exclude” for the platform=macos condition should be excluded.
In this way, a relationship is established between conditions (in the content) and output filtering criteria (in the map), ensuring that the generated manuals only include content relevant to their respective platforms.