<coderef>

A code reference is the mechanism for referencing an external text file that contains program code.

When evaluated, the <coderef> element causes the target code to be displayed inline. If the target code contains non-XML characters such as '<' or '&', those characters need to be handled so that they can be displayed correctly by the final rendering engine.

The <coderef> element is specialized from <include>. It is defined in the programming domain module.

The following attributes are available on this element: inclusion attributes, link-relationship attributes, universal attributes, and @keyref.

For this element, the @parse attribute has a default value of text.

Example

In the following code sample, the <coderef> element references the content of the process-dita.xsl file. In the rendered output, the XSL code will be presented in a code block.

<example>
  <title>Processing DITA</title>
  <p>This code is an example of how to process DITA.</p>
  <codeblock>
    <coderef href="process-dita.xsl"/>
  </codeblock>
</example>