DITA Conref: Reusing XML Paragraphs

DITA content referencing, commonly known as conref, is a core mechanism in Darwin Information Typing Architecture that allows technical writers to single-source content components across multiple documents. By pointing an empty element in a target document to an identical, fully authored element in a central source topic, conref ensures consistent paragraph reuse across varied publications. This article explains how the conref mechanism functions, its underlying syntax, and how it streamlines content maintenance during the publishing process.

The Mechanism of Content Referencing

The conref mechanism operates by establishing an explicit link between a source XML element and a target XML element of the exact same type. Instead of copying and pasting identical text—such as legal notices, safety warnings, or standard product descriptions—writers store the text once in a dedicated source file (often called a warehouse or reuse topic).

When another document requires that exact paragraph, the writer inserts an empty tag matching the element type and assigns it a conref attribute that points to the unique identifier of the source paragraph.

XML Syntax and Resolution

To execute a paragraph-level content reference, both the source topic and the specific source paragraph must have unique id attributes.

Source Paragraph Definition

In the source topic (warehouse.dita), the paragraph is assigned an ID:

<topic id="reuse_warehouse">
  <title>Reusable Content Warehouse</title>
  <body>
    <p id="standard_warranty">All products include a standard one-year limited hardware warranty covering manufacturing defects.</p>
  </body>
</topic>

Referencing the Paragraph

In the target topic (user_guide.dita), an empty paragraph references the source using the relative path, topic ID, and element ID:

<topic id="user_guide">
  <title>Product Maintenance</title>
  <body>
    <p conref="warehouse.dita#reuse_warehouse/standard_warranty"/>
  </body>
</topic>

During the publishing build process (typically managed by the DITA Open Toolkit), the processor resolves the reference by replacing the empty target element and its conref attribute with the full content of the source <p> element.

Rules for Valid Implementation

For a conref to function correctly, the XML parser enforces strict structural rules:

Operational Advantages Across Publications

Implementing conref for identical paragraphs yields several practical benefits across an organization’s content ecosystem: