How are metadata attributes used for styling in DITA output?

Metadata elements in DITA are used to store information about content that can be leveraged for styling and formatting when generating DITA output. Metadata provides valuable context to the content and can influence the presentation, layout, and behavior of the published output.

Metadata elements in DITA serve as a way to associate descriptive information with content components. This metadata can include details about the document, its structure, authorship, and other attributes. While metadata primarily serves informational purposes, it can also play a crucial role in styling the output through topic-level metadata, conditional styling, metadata-based indexing, and localization.

Topic-Level Metadata

Metadata can be associated with individual topics or sections within a document. This allows for the customization of styling or layout for specific topics. For example, metadata that indicates a topic can be defined to display in a different font or color.

Conditional Styling

Metadata can be used in conditional processing instructions (conrefs, keys, and flagging mechanisms) to conditionally include or exclude content based on metadata values. For example, content can be conditionally included in the output only if it has specific metadata attributes.

Metadata-Based Indexing

Metadata can influence how content is indexed in the generated output. By tagging topics with metadata, their appearance in the index can be controlled or custom index entries generated based on metadata values.


Metadata can include language information, allowing content to be styled differently based on the language it’s written in. This is particularly useful for multilingual publications.


A DITA document for a software user manual documents each feature in separate topics, and metadata is used for styling and organizing the output:

            <author>John Doe</author>
            <title>My Software User Manual</title>
            <product>Product XYZ</product>
            <audience>End Users</audience>

            <!-- Content goes here -->

            <title>Advanced Features</title>
            <!-- Content goes here -->

In this example:

  • Metadata elements <author>, <title>, <publicationdate>, <product>, and <audience> are associated with the entire document and can be used for generating a title page, copyright notice, and document header/footer.
  • Metadata elements <difficulty> and <platform> are associated with individual topics. They can be used to conditionally style content or generate topic-specific indexes. For example, you can style “Advanced Features” differently based on its difficulty level.