---
title: keyref
description: "## Syntax **keyref((name=\\name)(ID=id.file extension)** Where name is a key name ID is the ID of the target element, if applicable ## Purpose Keyrefs are used to identify and preserve variables in a document. Applying a keyref annotation converts plain text…"
url: "https://www.stilo.com/docs/migrate/prolog/keyref/"
updated: "2023-10-30"
category: Annotations / Prolog
tags:
  - Annotations
---

# keyref

## Syntax

**keyref((name=\name)(ID=id.file extension)**

Where name is a key name
 ID is the ID of the target element, if applicable

## Purpose

Keyrefs are used to identify and preserve variables in a document. Applying a keyref annotation converts plain text into a reference in the XML output. This allows the replication and preservation of variables. Maintaining keyrefs ensures easy propagation of changes throughout all single-sourced content.

## Examples

The following is an example of a time where you might want to use the keyref annotation:

![](https://www.stilo.com/wp-content/uploads/2023/10/stilo-dita-xml-annotation-keyref.png)

Note: In this example, variables are marked with a green box

The following is an example of a rule that will apply keyrefs:

![](https://www.stilo.com/wp-content/uploads/2023/10/stilo-dita-xml-annotation-keyref1-1024x111.png)

The following is an example of the DITA output you would get from this annotation.

 

`prereq>
<p>OmniMark Concurrent Processing Engine runs programs written in the <keyword keyref="Prodname"/> programming language.</p>
<p>To run <keyword keyref="Prodname"/> programs from source in OmniMark Concurrent Processing Engine:</p>
</prereq>`

The following is the DITA XML output for the sample text without assigning keyrefs:

`<prereq>
<p>OmniMark Concurrent Processing Engine runs programs written in the OmniMark programming language.</p>
<p>To run OmniMark programs from source in OmniMark Concurrent Processing Engine:</p>
</prereq>`

 

 
