How does conditional filtering work in DITA publishing?

Conditional filtering in DITA publishing is the process of selectively including or excluding content based on defined conditions when generating output. This technique enables organizations to create tailored publications for different audiences, products, languages, and more, optimizing content reuse and enhancing content relevance.

Conditional filtering in DITA publishing is a powerful feature that allows organizations to control which content is included or excluded in the final output, such as PDFs, web pages, or other formats. This involves defining conditions, conditioned content, filtering during publishing, and output customization.

Defining Conditions

In DITA, conditions are predefined attributes that can be applied to elements in the content. For example, conditions can be audience-specific (e.g., end-users, administrators, developers), language-specific (e.g., English, French), product version-specific (e.g., version 1.0, version 2.0), or even regulatory-specific (e.g., HIPAA compliance). Conditions are typically defined in DITA maps and topics.

Conditioned Content

Content authors apply these conditions to elements or entire topics in the DITA source. For example, an author might use a <audience> condition to mark content intended for end-users with <audience>end-user</audience>. This labeling indicates that this content is for end-users.

Filtering During Publishing

When content is published, the DITA publishing tool or engine processes the source files and evaluates the conditions. It then generates the output based on the defined conditions. Content labeled with specific conditions will be included in the output, while content with different conditions will be excluded. For example, if generating documentation for developers, content marked with <audience>end-user</audience> will be filtered out.

Output Customization

Conditional filtering allows organizations to create customized content for different scenarios. For example, a software company can produce user manuals tailored to various audience types (end-users, administrators, developers) without duplicating content. The same DITA source can be filtered differently to produce separate outputs for each audience.

Example

A software manual for a product with three distinct user groups: end-users, administrators, and developers includes sections relevant to each group. The following conditions are defined in the DITA map:

  • <audience>end-user</audience>
  • <audience>administrator</audience>
  • <audience>developer</audience>

Within the DITA source, content is tagged with the appropriate condition based on its relevance. For example, a troubleshooting section may be tagged with <audience>administrator</audience> to indicate that it’s for administrators.

When generating the documentation, conditional filtering is applied based on the target audience. If the goal is to create documentation for administrators, only content marked with <audience>administrator</audience> is included in the output. This ensures that the documentation is tailored to the specific audience’s needs, making it more concise and relevant.