|Content re-use / Variables|
The keyword element can be used as a container for variable words and phrases, when used in conjunction with the keydef element in the ditamap. Rather than enter the value of the keyword directly into the element, you can indirectly reference it through a key.
The keyref feature introduced in DITA 1.2 allows re-used terms or phrases that often vary according to output publication to be managed more easily. You can collect such variable terms into a keydef section in the ditamap, and then use the keyword and its keyref attribute to re-use them. You must also nominate a fallback value, in case the relevant key is not defined in any ditamap in which the topic is referenced.
Because the content model of the keyword element in a ditamap is different to that in a topic, you have to contain the ditamap keyword element within topicmeta and keywords elements.
Your <keyword keyref="car_name">car<keyword> has high intensity discharge headlamps.If that topic is included in a ditamap with a key defined as:
<keydef keys="car_name"> <topicmeta><keywords><keyword>Liberty</keyword></keywords></topicmeta> </keydef>the topic will be rendered as:
Your Liberty has high intensity discharge headlamps.
In this example, if the ditamap didn't have a definition for the car_name key, the word "car", which is the value of the keyword element in the topic, would be used in the output.