Can cross-references point to anchor IDs in the same topic or to external resources?

In DITA, cross-references can be incredibly versatile. They can point to different locations, either within the same topic using anchor IDs or to external resources, providing a seamless way to navigate content and enhance the user experience.

1. Cross-References to Anchor IDs in the Same Topic: You can create cross-references that link to specific anchor IDs within the same topic. This is particularly useful when you want to direct readers to a specific section or subsection of a topic. To create such a cross-reference, you typically use the <xref> element with the href attribute pointing to the anchor ID. Here’s an example:


<p>For more details, refer to the <xref href="#section-2"/>.</p>

2. Cross-References to External Resources: DITA also allows you to create cross-references that point to external resources, such as other DITA topics or non-DITA content like websites or documents. These cross-references often use full URLs or file paths. Here’s an example:


<p>To learn more about this topic, visit the <xref href="https://www.example.com/topic"/>.</p>

These cross-references make it easy to navigate between topics within your DITA content or direct readers to external sources for additional information.