Can content be filtered when reused in DITA topics?

In DITA, content filtering enables the selective inclusion or exclusion of parts of reused content when it is incorporated into a DITA topic. This is especially useful for reusing a topic with specific sections or elements needed for different contexts.

Content filtering is achieved by controlling which parts of a reused topic are included in the current topic. This control is implemented using conref attributes with filtering conditions. Filtering conditions are based on attributes like “audience,” “product,” or other criteria. This feature allows customization of content for different audiences, products, or scenarios.

Example:

A DITA topic covers a software feature. This topic includes sections specific to Windows and macOS. This topic can be reused in different parts of the documentation while including only the relevant sections based on the platform.

Original Topic – Software Feature:


<topic id="software-feature">
    <title>Software Feature</title>
    <body>
        <section conkeyref="win-software-feature" conref="path/to/software-feature.dita" audience="windows"/>
        <section conkeyref="mac-software-feature" conref="path/to/software-feature.dita" audience="macos"/>
    </body>
</topic>

Reuse in a Windows Topic:


<topic id="windows-specific">
    <title>Windows-specific Information</title>
    <body>
        <section conkeyref="software-feature" conref="path/to/software-feature.dita" audience="windows"/>
    </body>
</topic>

Reuse in a macOS Topic:


<topic id="macos-specific">
    <title>macOS-specific Information</title>
    <body>
        <section conkeyref="software-feature" conref="path/to/software-feature.dita" audience="macos"/>
    </body>
</topic>

In this example, content filtering is applied using the “audience” attribute, allowing for the reuse of the same topic for different platforms while including only the pertinent sections. This approach streamlines content management and ensures documentation aligns with the specific requirements of each audience.