Example: References to scoped keys

This section is non-normative.

You can address scoped keys from outside the key scope in which the keys are defined.

<map xml:lang="en">
  <title>Examples of scoped key references</title>

  <!-- Key scope #1 -->
  <topicgroup keyscope="scope-1">
    <keydef keys="key-1" href="topic-1.dita"/>
    <topicref keyref="key-1"/>
    <topicref keyref="scope-1.key-1"/>
    <topicref keyref="scope-2.key-1"/>
  </topicgroup>

  <!-- Key scope #2 -->
  <topicgroup keyscope="scope-2">
    <keydef keys="key-1" href="topic-2.dita"/>
    <topicref keyref="key-1"/>
    <topicref keyref="scope-1.key-1"/>
    <topicref keyref="scope-2.key-1" />
  </topicgroup>

  <topicref keyref="key-1" />
  <topicref keyref="scope-1.key-1" />
  <topicref keyref="scope-2.key-1" />

</map>

For this example, the effective key definitions are listed in the following tables.

Figure 1. Effective key definitions for scope-1
Key reference Resource
key-1 topic-1.dita
scope-1.key-1 topic-1.dita
scope-2.key-1 topic-2.dita
Figure 2. Effective key definitions for scope-2
Key reference Resource
key-1 topic-2.dita
scope-1.key-1 topic-1.dita
scope-2.key-1 topic-2.dita
Figure 3. Effective key definitions for the key scope associated with the root map
Key reference Resource
key-1 Undefined
scope-1.key-1 topic-1.dita
scope-2.key-1 topic-2.dita