A
preformatted paragraph is represented by the <pre> element.
An
itemized list is represented by the <ul> element. As expected,
it contains <li> list item
elements.
An ordered list is represented by the <ol> element.
A
variable list is represented by the <dl> element. Unlike HTML's
<dl>, the <dt> (term being defined)
and the <dd> (term definition)
elements must be wrapped in a <dlentry>
element.
<ul><li>First item.
<p>Continuation paragraph.</p></li><li>Second item. This item contains an ordered list.
<ol><li>First do this.</li><li>Then do that.</li><li>Finally do this.</li></ol></li><li>Third item. This item contains a variable list.
<dl><dlentry><dt>Term #1</dt><dd>Definition of term #1.</dd></dlentry><dlentry><dt>Term #2</dt><dd>Definition of term #2.</dd></dlentry></dl></li></ul>
The above example is rendered as follows:
First item.
Continuation paragraph.
Second item. This item contains an ordered list.
First do this.
Then do that.
Finally do this.
Third item. This item contains a variable list.
Term #1
Definition of term #1.
Term #2
Definition of term #2.
Sections
DITA has no
<h1>, <h2>,
<h3>, etc, heading elements. Instead it has the
<section> element which
generally always has a <title> child element. Note
that <section> elements cannot nest.
Example:
1
2
3
4
5
6
<section><title>The customary “hello word” program in Tcl/Tk</title><preframe="all">button .hello -text "Hello, World!" -command { exit }
pack .hello</pre></section>
Of course, DITA has also
figure, table and example elements.
The <example> element is just a
specialized kind of <section>.
The <fig> element generally has
a <title> and generally contains an
<image> element.
Like
<img>, its HTML counterpart, the <image> “inline element”
may be contained in any “block element”. The graphics file to be displayed
is specified using the <href> attribute. The
<image> element also has @width,
@height,@scale and @align
attributes.
Example:
1
2
3
4
5
6
7
8
9
10
<example><title>Converting a color image to black and white</title><pre>$ convert -dither Floyd-Steinberg -monochrome photo.png bwphoto.gif</pre><fig><title>The photo converted to black and white</title><imagehref="bwphoto.gif"align="center"/></fig></example>
Figure 3-1. The photo converted to black and white
Tables
DITA has two kinds of table element:
<simpletable> which is
specific to DITA, and <table> which is in fact a
CALS table (also know as a DocBook
table).
A <simpletable> element
contains an optional <sthead> element, followed
by one or more <strow> elements. Both row
elements, <sthead> and
<strow>, contain <stentry> cell elements.
The @relcolwidth attribute may be used to specify the
relative width of each column.
The above example is rendered as
follows:
A
B
C
A,1
B,1
C,1
A,2
B,2
C,2
Same as above example but using a CALS
<table> this time:
CALS tables are quite complex and explaining how they
can be used is out of the scope of this tutorial. Our recommendation is to
use CALS tables rather than <simpletable>s only
when you want a cell to span more than one row and/or more than one
column.