example
The <example> element is a section with the specific role of containing examples that illustrate or support the current topic. The <example> element has the same content model as <section>.
DITA uses <example> to contain both discussion and sample code or outputs. Hence, in a DITA topic, to represent programming code and results within the discussion in an example, use the <codeblock> and <systemoutput> elements within the example element. For lines of text, use the <lines> element. For pre-formatted text such as email headers, use the <pre> element.
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 (base) | |
topic (technical content), concept, ditabase, glossary, glossentry, glossgroup, reference, task | |
machineryTask | |
learningAssessment, learningContent, learningOverview, learningPlan, learningSummary | |
Contained by
Doctype | Content model |
topic (base), topic (technical content), learningAssessment, learningOverview, learningPlan, learningSummary | |
concept, glossary, glossentry, glossgroup | |
ditabase | |
reference | |
task (strict), task (general), machineryTask | |
learningContent | |
Inheritance
- topic/example
Example 45. Example
<example id="example">
<title>Example</title>
<codeblock><p>Example of the p element</p></codeblock>
</example>
Attributes
Name | Description | Data Type | Default Value | Required? |
spectitle | The specialized title attribute allows architects of specialized types to define a fixed or default title for a specialized element. Not intended for direct use by authors. | CDATA | #IMPLIED | No |
univ-atts attribute group (includes select-atts, id-atts, and localization-atts groups) | | | | |
global-atts attribute group (xtrf, xtrc) | | | | |
class, outputclass | | | | |
Parent topic