The <coderef> element references an external file that contains literal code. When evaluated, the <coderef> element causes the target code to be displayed inline. If the target contains non-XML characters such as '<' or '&', those will need to be handled in a way that they can be displayed correctly by the final rendering engine. This element is part of the DITA programming domain, a special set of DITA elements designed to document programming tasks, concepts, and reference information.

Content models

See appendix for information about this element in OASIS document type shells.


+ topic/xref pr-d/coderef


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


The following attributes are available on this element: Universal attribute group, Link relationship attribute group, @outputclass, and @keyref.

Was this helpful?