Key scopes enable you to create omnibus publications that include multiple submaps that define the same key names for common items, such as product names or common topic clusters.
In this scenario, a training organization wants to produce a deliverable that includes all of their training course materials. Each course manual uses common keys for standard parts of the course materials, including "prerequisites," "overview", "assessment", and "summary.
An information architect creates a root map that contains the following markup:
<map xml:lang="en">
<title>Training courses</title>
<mapref href="course-1.ditamap"/>
<mapref href="course-2.ditamap"/>
<mapref href="course-3.ditamap"/>
<topicref href="omnibus-summary.dita"/>
</map>
Each of the submaps contain <topicref>
elements that refer to resources using the @keyref
attribute. Each submap uses
common keys for standard parts of the course materials, including "prerequisites," "overview",
"assessment", and "summary", and their key definitions bind the
key names to course-specific resources. For example:
<map xml:lang="en">
<title>Training course #1</title>
<mapref href="course-1/key-definitions.ditamap"/>
<topicref keyref="prerequisites"/>
<topicref keyref="overview"/>
<topicref keyref="assessment"/>
<topicref keyref="summary"/>
</map>
Without using key scopes, the effective key definitions for the common keys resolve to those found in course-1.ditamap. This is not the desired outcome. By adding key scopes to the submaps, however, the information architect can ensure that the key references in the submaps resolve to the course-specific key definitions.
<map xml:lang="en">
<title>Training courses</title>
<mapref href="course-1.ditamap" keyscope="course-1"/>
<mapref href="course-2.ditamap" keyscope="course-2"/>
<mapref href="course-3.ditamap" keyscope="course-3"/>
<topicref href="omnibus-summary.dita"/>
</map>
The information architect does not set keys="summary"
on the
<topicref>
element in the root map. Doing so would mean that all key
references to "summary" in the submaps would resolve to
omnibus-summary.dita, rather than the course-specific summary topics.
This is because key definitions located in parent scopes override those located in child
scopes.