<topicref>: How do you use the <topicref> element to reference and include individual DITA topics within a DITA map?

The <topicref> element in DITA XML is used to reference and include individual DITA topics within a DITA map, enabling the organization and assembly of content into structured information sets. It allows for the inclusion of topics, such as chapters, sections, or other modular content, within a DITA map to create a cohesive document or publication.

Referencing Topics

The <topicref> element typically includes attributes like “href” to specify the location of the target DITA topic and “format” to define the output format. Here’s an example of how the <topicref> element is used:


<map>
  <title>Sample DITA Map</title>
  <topicref href="topic1.dita" format="dita"/>
  <topicref href="topic2.dita" format="dita"/>
  <topicref href="topic3.dita" format="dita"/>
</map>

In this example, the <topicref> elements reference individual DITA topics, such as “topic1.dita,” “topic2.dita,” and “topic3.dita.” These topics can be separate DITA files, and the “format” attribute specifies the format in which the topics should be included.

Content Organization

Using <topicref> elements in a DITA map provides a high level of flexibility in content organization. You can arrange topics in the desired order, create hierarchies, and assemble them into meaningful publications, making it easier to manage and deliver structured content.