What is the syntax for creating cross-references in DITA?

Cross-references in DITA are a powerful way to link to specific locations or topics within your documentation, allowing readers to navigate seamlessly through related content. To create a cross-reference, you typically use the <xref> element in DITA XML. The syntax for creating a basic cross-reference consists of specifying the target topic using the “href” attribute within the <xref> element, along with an optional link text to describe the link’s purpose. Here’s a simplified example:


<xref href="target-topic.dita">Link Text</xref>

In this example, “target-topic.dita” represents the DITA topic or location you want to link to, and “Link Text” is the descriptive text that will be displayed as the link in the output. This is a straightforward way to create cross-references in DITA, and it allows you to provide context and clarity to your readers.

However, DITA provides more advanced capabilities for cross-references, such as conditional processing attributes and linking to specific sections within a topic. These features can be particularly useful in complex documentation scenarios. Cross-references in DITA are a versatile tool for enhancing the usability and navigational structure of your content.