What happens if a key reference cannot be resolved in DITA?

In DITA, key references play a crucial role in content reuse. A key reference is used to point to specific content within a DITA document or across documents. However, when a key reference cannot be resolved, it leads to issues that affect the integrity of content.

Reasons for Unresolved Key References:

  • Typo or Error:

    The key reference might contain a typo, an error in the key name, or be missing a defined key within the same document or a referenced one.

  • Scope Mismatch:

    The key reference might be outside the scope where the key is defined. Keys have a scope that determines where they are accessible, and if a reference is made from an inappropriate location, it can’t be resolved.

Consequences of Missing Key References:

  • Missing Content:

    When a key reference can’t be resolved, the content that was supposed to be inserted or referenced is missing from the output, which may result in incomplete or unclear information.

  • Content Breakage:

    The document may break in the output rendering, causing disruptions in the user experience. For example, if a key reference is meant to provide an important warning but remains unresolved, critical safety information could be omitted.

Example:

A DITA topic discussing product safety guidelines. The author intends to insert a safety warning using a key reference:

<note conref="#safety_warning_electrical" />

However, there is no key defined with the name “safety_warning_electrical” in the document or any of the referenced documents. As a result, the key reference remains unresolved, and the safety warning is not included in the output. This could lead to a potentially hazardous situation if the warning was crucial for users.