Example: Key definition with key reference
When a key definition also specifies a key reference, the key reference must also be resolved in order to determine the effective resources bound to that key definition.
In the following example, a topicref element references the key "widget". The definition for "widget" in turn references the key "mainProduct".
<map>
<topicref keyref="widget" id="example"/>
<keydef keys="widget" href="widgetInfo.dita" scope="local" format="dita" rev="v1r2"
keyref="mainProduct">
<topicmeta><navtitle>Information about Widget</navtitle></topicmeta>
</keydef>
<keydef keys="mainProduct" href="http://example.com/productPage" scope="external" format="html"
product="prodCode" audience="sysadmin">
<topicmeta><navtitle>Generic product page</navtitle></topicmeta>
</keydef>
</map>
For this example, the key reference to "widget" pulls resources from that key definition, which in turn pulls resources from "mainProduct". The metadata resources from "mainProduct" are combined with the resources already specified on the "widget" key definition, resulting in the addition of product and audience values. Along with the navigation title, the href, scope, and format attributes on the "widget" key definition override those on "mainProduct". Thus after key references are resolved, the original reference from topicref is equivalent to:
<topicref id="example"
href="widgetInfo.dita" scope="local" format="dita" rev="v1r2"
product="prodCode" audience="sysadmin">
<topicmeta><navtitle>Information about Widget</navtitle></topicmeta>
</topicref>
Parent topic