Conditions versus transclusion

Transclusion, or content referencing, can sometimes achieve the same publishing aim as conditional processing. There are pros and cons for either method.

There are single-source publishing scenarios where a desired result can be achieved with either conditional processing or with transclusion (the conref feature).

For example, if a product name was going to vary between two choices from publication to publication, conditional processing with a product attribute could be used to exclude the inappropriate product name (to leave the appropriate product name). The code might look like: <ph product="Liberty">Liberty><ph product="Legend">Legend</ph>. When a ditaval rule of exclude elements with a product attribute of Liberty is applied, the remaining code would be <ph product="Legend">Legend</ph>.

The alternative approach would be to use transclusion, such as through a content reference (conref) to achieve the same result. The product name would not be included directly in the text; instead, a conref would be used to draw the phrase in from a separate conref file. The code might look like: <ph conref="conref_source/product_name" />. When a publication for the product with a name of "Legend" is required, the conref source file could be modified so that the conref source code was: <ph id="product_name">Legend</ph>.

The keyref feature introduced in DITA 1.2 makes this second transclusion method a lot easier and cleaner.

There are pros and cons with either approach.

The main advantages of the conditional processing method are:
The main advantages of the transclusion method are: