<keydef>
A key definition provides a simple way to define a key without making the definition itself a part of rendered content.
Usage information
The <keydef>
element is a convenience element. It is equivalent to
a <topicref>
element that defines a key while also setting
@processing-role
to resource-only.
Attributes defaulted on the <keydef>
element ensure that key
definitions do not appear in tables of contents, do not add extra links, and are not
rendered as topics.
Specialization hierarchy
The <keydef>
element is specialized from
<topicref>
. It is defined in the mapgroup-domain module.
Attributes
The following attributes are available on this element: common map attributes, link-relationship attributes, universal
attributes, @impose-role
, and
@keyref
.
- The
@impose-role
attribute has a fixed value of keeptarget. - The
@keys
attribute is required. - The
@href
attribute might be omitted when the key definition is used for variable text. - The
@processing-role
attribute has a default value of resource-only.
Example
The following code sample shows several different types of key definitions:
<map>
<title>Possible keys for use in the DITA specification</title>
<!-- Key definition #1-->
<keydef keys="dita-tc" scope="external" format="html"
href="https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=dita">
<topicmeta>
<keytext>DITA Technical Committee</keytext>
</topicmeta>
</keydef>
<!-- Key definition #2-->
<keydef keys="addressing" href="dita-addressing.dita"/>
<!-- Key definition #3-->
<keydef keys="dita-version">
<topicmeta>
<keytext>2.0</keytext>
</topicmeta>
</keydef>
</map>
- The first
<keydef>
element defines a key that links to a web page. It contains link text; it also specifies the necessary@scope
and@format
attributes, so that authors do not need to include them when they reference this key. - The second
<keydef>
element defines a key for a local DITA topic about addressing in DITA; that topic is available to resolve link text. - The third
<keydef>
element defines a text-only key that specifies the current DITA version number.