Key text

Key text is variable or link text that is used when resolving key references. It also specifies alternate text for images that are referenced by keys.

Syntax

The syntax for representing this component varies depending on the authoring format:

Authoring format Syntax and example
XDITA

<keytext>

<keydef keys="product-name">
  <topicmeta>
    <keytext>Remote Network Lighting</keytext>
  </topicmeta>
</keydef>
HDITA

<span data-class="keytext">

div data-class="keydef">
  <span data-class="keytext" data-keys="product-name">Remote Lighting Network</span>
</div>
MDITA

There is no specific support in the MDITA core profile. If needed, use an HDITA snippet.

Processing expectations

See "Processing key reference to generate text or link text" in the DITA 2.0 specification.

Attributes

The available attributes vary based on the authoring format:

XDITA and HDITA
The following attributes are available on this element: localization attributes and universal attributes.
MDITA
There is no attribute support for the MDITA core profile. For the MDITA extended profile, attributes can be specified by using the HDITA representation.

Examples

This section is non-normative.

This section contains examples of how the key text component can be used.

Example 1. XDITA key text

The following code sample shows how the <keytext> element can be used to create variable text for a product name, as well as alternate text for an image referenced by @keyref:

<!-- Key definitions for images -->
  <keydef keys="icon-save" href="icons/save.gif" format="gif" scope="local">
    <keytext>Save icon</keytext>
  </keydef>
  <!-- Variable text definition -->
  <keydef keys="product-greenhouse">
    <topicmeta>
      <keytext>Acme Greenhouse</keytext>
    </topicmeta>
  </keydef>
Example 2. HDITA key text

The following code sample shows how the <keytext> element can be used to create variable text for a product name, as well as alternate text for an image referenced by @keyref:

<!-- Key definitions for images -->
  <div data-class="keydef" 
       data-keys="icon-save" 
       href="icons/save.gif" format="gif" scope="local">
    <span data-class="keytext">Acme Greenhouse</span>
  </div>
  <!-- Variable text definition -->
  <div data-class="keydef" data-keys="product-greenhouse">
    <span data-class="keytext">Acme Greenhouse</span>
  </div>
Example 3. MDITA key text

The following code sample shows how the <keytext> element can be used to create variable text for a product name, as well as alternate text for an image referenced by @keyref:

<!-- Key definitions for images -->
  <div data-class="keydef" 
       data-keys="icon-save" 
       href="icons/save.gif" format="gif" scope="local">
    <span data-class="keytext">Acme Greenhouse</span>
  </div>
  <!-- Variable text definition -->
  <div data-class="keydef" data-keys="product-greenhouse">
    <span data-class="keytext">Acme Greenhouse</span>
  </div>