How do reference topics handle cross-referencing to other content?
DITA reference topics handle cross-referencing to other content by using specialized elements and attributes to create links between related topics, just like any other DITA topic type. These cross-references enable users to navigate seamlessly between topics, providing additional context and information when needed.
Cross-Referencing Elements and Attributes
Cross-referencing is typically carried out with specific elements, target identification, attributes, and link text.
Element Types:
DITA provides several element types for cross-referencing, including <xref>, <link> and <anchor>. These elements play a key role in creating links between topics.
Target Identification:
To create a cross-reference, authors specify the target topic or location within a target topic using identifiers or keys. These identifiers can be based on topic titles, IDs, or other attributes.
Attributes:
Cross-referencing elements often include attributes that define the type of reference, such as href
for specifying the target topic’s location and format
for defining the output format (e.g., HTML, PDF) of the link.
Link Text:
Authors can provide link text to be displayed to users. This text is what users click on to access the referenced topic. It can be customized to provide meaningful context.
Example:
<reference>
<title>HTTP Status Codes</title>
<body>
<p>For more information about HTTP request methods, refer to the <xref href="httprequests.dita">HTTP Requests</xref> topic.</p>
</body>
</reference>
In this example:
<xref> is used to create the cross-reference.
href="httprequests.dita" specifies the target topic's location (in this case, "httprequests.dita").
The link text, "HTTP Requests," is provided within the <xref> element to indicate what users should click on.