What are conditional links in DITA XML?

Conditional links in DITA XML provide a powerful way to control which content is displayed to users based on specific conditions or criteria. They enable content creators to tailor the information presented to users, ensuring that it remains relevant and personalized. Conditional links are a valuable feature in DITA for creating content that can be reused in various contexts while still meeting the specific needs of different audiences.

Conditional Attributes

In DITA, conditional links are typically achieved using conditional attributes such as conkeyref and conref. These attributes allow you to specify conditions under which the linked content should be included or excluded. For example, you can use conditional attributes to display content relevant to a particular audience, product version, or platform. This means that users will see content that is directly applicable to their situation, enhancing the overall user experience.

Example:

Here’s an example of conditional links in DITA XML:


<para conref="product-description.dita" conkeyref="product-edition"/><!-- This links to product information based on the edition. -->

In this example, the conref attribute links to a DITA topic, and the conkeyref attribute specifies the condition to apply, such as the product edition. The linked content will vary depending on the edition, ensuring that users receive information relevant to their specific product version.