Can filtering conditions be based on metadata or user-defined attributes?

DITA allows filtering conditions to be based on metadata and user-defined attributes, providing a powerful way to selectively include or exclude content during publishing. This enables fine-grained control over content customization, making it highly adaptable to different output requirements.

Metadata-Based Filtering

DITA’s flexibility in filtering conditions extends beyond predefined criteria like audience, product, and platform. It supports using metadata and user-defined attributes to filter content. This capability enables organizations to achieve highly tailored content customization based on specific criteria.

Metadata

Metadata refers to information associated with a topic that provides additional context about the content. Metadata can include elements like <keyword>, <props>, or <audience>, which are added to topics to describe their characteristics or properties. These metadata elements are useful for content filtering.

For example, consider a software documentation project where topics have metadata such as <keyword> for functionality tags. Topics may include metadata like <keyword>installation</keyword>, <keyword>configuration</keyword>, or <keyword>troubleshooting</keyword>. Using metadata-based filtering, topics can be included or excluded with specific <keyword> values when generating output. This ensures that the published content is tailored to the needs of the audience, focusing on relevant functionalities.

User-Defined Attributes

User-defined attributes are a more advanced form of filtering. Organizations can create their own custom attributes to meet specific requirements. Custom attributes are added directly to DITA elements, providing granular control over content inclusion or exclusion.

For example, in a manufacturing environment, a DITA-based documentation system might include custom attributes such as <safety-level>, which indicates the safety level of procedures. Topics could be tagged with <safety-level>high</safety-level>, <safety-level>medium</safety-level>, or <safety-level>low</safety-level>. During publishing, content can be filtered based on this custom attribute, ensuring that the safety level information aligns with the audience’s needs.

Example

Metadata and user-defined attributes are used to control filtering in a DITA map.

<map>
  <title>My Documentation Map</title>
  <topicref href="topic1.dita">
    <keyword>installation</keyword>
  </topicref>
  <topicref href="topic2.dita">
    <keyword>configuration</keyword>
  </topicref>
  <topicref href="topic3.dita">
    <safety-level>high</safety-level>
  </topicref>
</map>

In this map, topics are associated with metadata and a user-defined attribute, allowing for filtering and customization during publishing.