Conditions in cross-references

The standard DITA metadata attributes of audience, platform, product, and otherprops can be applied to xref elements to allow conditional processing of cross-references. Positioning cross-references at the end of a sentence makes it easier to exclude the cross-reference without affecting the sense of the sentence.

If you need to cross-reference different resources for different publication variants, use the audience attribute to define these conditions. For example, if the PDF version of the output links to a different resource than the Help version, you could include two adjacent xref elements, one with the audience attribute set to pdf_user, and the other set to help_user.

For DITA 1.2 and above, the keyref mechanism should be used in preference to duplicating and conditionalising elements.

If you are using cross-references in conjunction with conditional processing, positioning an in-text cross-reference (xref) element at the end of a sentence makes it easier to exclude.

For example, if a cross-reference is to be included in the Web rendition of a DITA collection, but excluded from the PDF rendition, then audience attribute might be used to differentiate the PDF-only text.

The code:
<p>The coolant expansion tank is attached to 
the firewall<ph audience="help_user">, as shown in 
<xref href="c_engine_bay#eng_bay/fig_coolant_system" type="fig"/></ph>.
</p>
might be rendered in the output as The coolant expansion tank is attached to the firewall. when the help_user content is excluded, and as The coolant expansion tank is attached to the firewall, as shown in Figure 3. otherwise.