coderef

The <coderef> element references an external file that contains literal code. When evaluated, the <coderef> element should cause 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 may 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.

Contains

Note

These models represent only the default document types distributed by OASIS. Actual content models will differ with each new document type.
Doctype Content model
topic (technical content), map (technical content), concept, ditabase, glossary, glossentry, glossgroup, reference, task, bookmap no content

Contained by

Doctype Content model
topic (technical content), map (technical content), concept, ditabase, glossary, glossentry, glossgroup, reference, task (strict), task (general), bookmap codeblock

Inheritance

- topic/xref pr-d/coderef

Example

<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>

Attributes

Name Description Data Type Default Value Required?
href Provides a reference to a resource. See The href attribute for detailed information on supported values and processing implications. CDATA #IMPLIED No
type Describes the target of a reference. See The type attribute for detailed information on supported values and processing implications. CDATA #IMPLIED No
format The format attribute identifies the format of the resource being referenced. See The format attribute for details on supported values. CDATA #IMPLIED No
scope The scope attribute identifies the closeness of the relationship between the current document and the target resource. See The scope attribute for more information on values. (local | peer | external | -dita-use-​conref-​target) #IMPLIED No
univ-atts attribute group (includes select-atts, id-atts, and localization-atts groups) A set of related attributes, described in univ-atts attribute group
global-atts attribute group (xtrf, xtrc) A set of related attributes, described in global-atts attribute group
class, outputclass, keyref Keyref provides a redirectable reference based on a key defined within a map. See The keyref attribute for information on using this attribute. Class and outputclass are described in Other common DITA attributes

Was this helpful?