1. Introduction
4.1. The concept element
4.2. The task element
5. Topic maps
5.1. The map element
5.2. The bookmap element
6. Conclusion
![]() |
Remember
|
<topic>
element <topic>
<topic>
element ![]() |
RememberA
<topic> element must always
be given an ID. Use the @id attribute to specify
it. |
<topic>
<title>
<shortdesc>
<abstract>
<shortdesc>
element is longer
and more descriptive than the <title>
element.
However, it is recommended to keep it short, approximately one paragraph
long, because the contents of this element are often used during
navigation (e.g. to generate a detailed table of contents).<abstract>
element is intended to contain more
information than the <shortdesc>
element.<related-links>
<link>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
<topic id="docbook_or_dita"> <title>DITA or DocBook?</title> <shortdesc>Both DITA and DocBook are both mature, feature rich, document types, so which one to choose?</shortdesc> <body> <p>DocBook 5 is a mature document type. It is well-documented (DocBook: The Definitive Guide, DocBook XSL: The Complete Guide), featuring decent XSL stylesheets allowing conversion to a variety of formats, based on the best schema technologies: RELAX NG and Schematron.</p> <p>DITA concepts (topics, maps, specialization, etc) have an immediate appeal to the technical writer, making this document type more attractive than DocBook. However the DocBook vocabulary is comprehensive and very well thought out. So choose DITA if its technical vocabulary is sufficiently expressive for your needs or if, anyway, you intend to specialize DITA.</p> </body> <related-links> <link format="html" href="http://www.docbook.org/" scope="external"> <linktext>DocBook 5</linktext> </link> <link format="html" href="http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=dita" scope="external"> <linktext>DITA</linktext> </link> </related-links> </topic> |
Both DITA and DocBook are both mature, feature rich, document types, so which one to choose?
<p>
<pre>
<ul>
<li>
<ol>
<dl>
<dl>
, the <dt>
<dd>
<dlentry>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
<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> |
<h1>
, <h2>
,
<h3>
, etc, heading elements. Instead it has the
<section>
<title>
<section>
elements cannot nest.
Example:
1 2 3 4 5 6 |
<section> <title>The customary “hello word” program in Tcl/Tk</title> <pre frame="all">button .hello -text "Hello, World!" -command { exit } pack .hello</pre> </section> |
button .hello -text "Hello, World!" -command { exit } pack .hello
<example>
<section>
.<img>
, its HTML counterpart, the <image>
<href>
attribute. The
<image>
element also has @width
,
@height,
@scale
and @align
attributes.
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> <image href="bwphoto.gif" align="center"/> </fig> </example> |
$ convert -dither Floyd-Steinberg -monochrome photo.png bwphoto.gif
<simpletable>
<table>
<Simpletable>
example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<simpletable relcolwidth="1* 2* 3*"> <sthead> <stentry>A</stentry> <stentry>B</stentry> <stentry>C</stentry> </sthead> <strow> <stentry>A,1</stentry> <stentry>B,1</stentry> <stentry>C,1</stentry> </strow> <strow> <stentry>A,2</stentry> <stentry>B,2</stentry> <stentry>C,2</stentry> </strow> </simpletable> |
<simpletable>
element
contains an optional <sthead>
<strow>
<sthead>
and
<strow>
, contain <stentry>
@relcolwidth
attribute may be used to specify the
relative width of each column.A | B | C |
A,1 | B,1 | C,1 |
A,2 | B,2 | C,2 |
<table>
this time:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
<table> <title>Sample CALS table</title> <tgroup cols="3"> <colspec colwidth="1*"/> <colspec colwidth="2*"/> <colspec colwidth="3*"/> <thead> <row> <entry align="center">A</entry> <entry align="center">B</entry> <entry align="center">C</entry> </row> </thead> <tbody> <row> <entry>A,1</entry> <entry>B,1</entry> <entry>C,1</entry> </row> <row> <entry>A,2</entry> <entry>B,2</entry> <entry>C,2</entry> </row> </tbody> </tgroup> </table> |
<simpletable>
s only
when you want a cell to span more than one row and/or more than one
column.A | B | C |
A,1 | B,1 | C,1 |
A,2 | B,2 | C,2 |
<i>
<b>
<tt>
<sub>
<sup>
<tt>
, instead use <filepath>
<i>
, instead use <varname>
<b>
, instead use <cmdname>
![]() |
RememberUsing the most specific elements rather than the
generic
<i> , <b> ,
<tt> elements, means getting nicer deliverables.
Example: Let's suppose you want to refer to the "Open" item of
the "File" menu. Do not type
<tt>File->Open</tt> which would be
rendered as: File->Open. Instead type
<menucascade><uicontrol>File</uicontrol><uicontrol>Open</uicontrol></menucascade>,
which will be rendered as:
. Much nicer, isn't it?See
<uicontrol> ![]() <menucascade> ![]() |
<xref>
and <link>
elements <xref>
“inline element” may be contained in
any “block element”.<link>
element may be contained only in a
<related-links>
<link>
element, this text must be wrapped in a
<linktext>
@href
attribute, which is an absolute or relative URL,
possibly ending with a fragment.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
<xref href="topic_structure.dita"/> <xref href="http://www.xmlmind.com/xmleditor/" format="html" scope="external">XMLmind XML Editor</xref> <link href="samples/sample_topic.dita#docbook_or_dita"/> <link href="http://www.xmlmind.com/ditac/" format="html" scope="external"> <linktext>XMLmind DITA Converter</linktext> </link> |
![]() |
Remember
|
<xref>
or <link>
element)
is a DITA element belonging to the same DITA document. This target element
may be found in the same XML file as the link element or, on the contrary,
in a different XML file. The latter case is still considered to be an
internal link because both the link and its target belong to the same
overall DITA document.@id
attribute.@href
attribute of a
link element is:
"URL_of_the_target_DITA_file#qualified_ID_of_the_target_element",
where:@id
attribute for a
topic element (of any kind: <topic>
,
<concept>
, <reference>
,
etc).@id
attribute of the target
element prefixed by "ID_of_the_topic_ancestor/"
for any descendant element of a topic.<xref>
element to
topic1.dita
:
1 2 3 4 5 6 7 |
<topic id="t1"> <title>Title of topic 1</title> <body> <p id="p1">Paragraph inside topic 1.</p> <p>More information in <xref href="???"/>.</p> </body> </topic> |
topic2.dita
, this file being found in
the same directory as topic1.dita
.
1 2 3 4 5 6 |
<topic id="t2"> <title>Title of topic 2</title> <body> <p id="p2">Paragraph inside topic 2.</p> </body> </topic> |
![]() |
Remember
|
<topic>
<concept>
<task>
<reference>
<glossentry>
<topic>
.<concept>
element <concept>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
<concept id="what_is_a_cache"> <title>What is a cache?</title> <shortdesc>Everything you'll ever need to know about <term>cache</term>s.</shortdesc> <conbody> <p>In computer science, a cache is a temporary storage area where frequently accessed data can be stored for rapid access.</p> </conbody> <related-links> <link format="html" href="http://en.wikipedia.org/wiki/Cache" scope="external"> <linktext>Wikipedia definition of a cache</linktext> </link> </related-links> </concept> |
<concept>
element
is similar to the structure of a <topic>
element.
Moreover, a <conbody>
<body>
Everything you'll ever need to know about caches.
<task>
element <task>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
<task id="install_emacs"> <title>Installing GNU Emacs</title> <taskbody> <prereq>Windows NT 4.0 or any subsequent version of Windows. 5Mb of free disk space.</prereq> <steps> <step> <cmd>Unzip the distribution anywhere.</cmd> <info>We recommend to use the free, open source, <xref format="html" href="http://www.info-zip.org/" scope="external">Info-ZIP</xref> utility to do so.</info> <stepxmp><screen>C:\> unzip emacs-21.3-bin-i386.zip</screen></stepxmp> <stepresult><p>Doing this will create an <filepath>emacs-21.3</filepath> directory.</p></stepresult> </step> <step> <cmd>Go to the bin subdirectory.</cmd> <stepxmp><screen>C:\> cd emacs-21.3\bin</screen></stepxmp> </step> <step> <cmd>Run <cmdname>addpm</cmdname>.</cmd> <stepxmp><screen>C:\emacs-21.3\bin> addpm</screen></stepxmp> <stepresult>A confirmation dialog box is displayed.<fig> <image href="confirm_install_emacs.png"/> </fig></stepresult> </step> <step> <cmd>Click <uicontrol>OK</uicontrol> to confirm.</cmd> </step> </steps> </taskbody> </task> |
<task>
element is also the most useful one. Its
<taskbody>
<steps>
<prereq>
<context>
<result>
<step>
<cmd>
<info>
<stepxmp>
<substeps>
<choices>
<stepresult>
C:\> unzip emacs-21.3-bin-i386.zip
emacs-21.3
directory.C:\> cd emacs-21.3\bin
addpm
.C:\emacs-21.3\bin> addpm
<reference>
element <reference>
<reference>
element is typically used to document a
command or a function.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<reference id="pwd_command"> <title>The <cmdname>pwd</cmdname> command</title> <refbody> <refsyn><cmdname>pwd</cmdname></refsyn> <section><title>DESCRIPTION</title><p>Print the full filename of the current working directory.</p><note>Your shell may have its own version of <cmdname>pwd</cmdname>, which usually supersedes the version described here.</note></section> <section><title>AUTHOR</title><p>Written by John Doe. </p></section> </refbody> <related-links> <link format="html" href="http://www.manpagez.com/man/3/getcwd/" scope="external"> <linktext><cmdname>getcwd</cmdname>(3)</linktext> </link> </related-links> </reference> |
<refbody>
<reference>
can contain the following generic
elements: <section>
<example>
<simpletable>
<table>
<refsyn>
<properties>
pwd
command pwd
![]() |
NoteYour shell may have its own version of
pwd , which usually supersedes the version described
here. |
<glossentry>
element <glossentry>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
<glossgroup id="sample_glossary"> <title>Sample glossary</title> <glossentry id="ajax"> <glossterm>AJAX</glossterm> <glossdef><b>A</b>synchronous <b>Ja</b>vaScript and <b>X</b>ML. Web development techniques used on the client-side to create interactive web applications.</glossdef> </glossentry> <glossentry id="dhtml"> <glossterm>DHTML</glossterm> <glossdef><b>D</b>ynamic <b>HTML</b>. Web development techniques used on the client-side to create interactive web sites.</glossdef> </glossentry> <glossentry id="javascript"> <glossterm>JavaScript</glossterm> <glossdef>JavaScript is an object-oriented scripting language supported by all major web browsers. It allows the development of interactive web sites and web applications.</glossdef> <related-links> <link format="html" href="https://developer.mozilla.org/en/JavaScript" scope="external"> <linktext>Mozilla's Official Documentation on JavaScript</linktext> </link> </related-links> </glossentry> </glossgroup> |
<glossentry>
element is the simplest
specialized topic type. It contains a <glossterm>
<glossdef>
<related-links>
<glossgroup>
<glossentry>
elements.![]() |
Remember
|
<map>
element <map>
<title>
<topicmeta>
<topicref>
<href>
attribute of a
<topicref>
element specifies the URL of a topic
which is part of the DITA document. Example:<topicref href="samples/sample_glossary.dita"/>
<topicref href="samples/sample_glossary.dita#javascript"/>
<topicref>
elements. What does this mean?
1 2 3 4 5 6 7 8 |
<topicref href="topic.dita"> <topicref href="topic_structure.dita"> <topicref href="samples/sample_topic.dita"/> </topicref> <topicref href="block_elements.dita"/> <topicref href="inline_elements.dita"/> <topicref href="link_elements.dita"/> </topicref> |
topic.dita
,
topic_structure.dita
,
samples/sample_topic.dita
,
block_elements.dita
,
inline_elements.dita
,
link_elements.dita
.topic_structure.dita
,
block_elements.dita
,
inline_elements.dita
,
link_elements.dita
are subsections of topic
topic.dita
. Topic
samples/sample_topic.dita
is a subsection of topic
topic_structure.dita
.
tutorial.ditamap
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
<map> <title>DITA for the Impatient</title> <topicmeta> <author>Hussein Shafie</author> <publisher>Pixware</publisher> <critdates> <created date="October 7, 2009"/> </critdates> </topicmeta> <topicref href="introduction.dita"/> <topicref href="topics_and_maps.dita"/> <topicref href="topic.dita"> <topicref href="topic_structure.dita"> <topicref href="samples/sample_topic.dita" toc="no"/> </topicref> <topicref href="block_elements.dita"/> <topicref href="inline_elements.dita"/> <topicref href="link_elements.dita"/> </topicref> . . . <topichead navtitle="Topic maps"> <topicref href="map.dita"/> <topicref href="bookmap.dita"/> </topichead> <topicref href="conclusion.dita"/> </map> |
@toc
attribute<topicref>
element prevents it from appearing in the generated Table of
Contents.
1 2 3 |
<topicref href="topic_structure.dita"> <topicref href="samples/sample_topic.dita" toc="no"/> </topicref> |
<topichead>
element<topichead>
1 2 3 4 |
<topichead navtitle="Topic maps"> <topicref href="map.dita"/> <topicref href="bookmap.dita"/> </topichead> |
<bookmap>
element <bookmap>
<map>
<bookmap>
for anything more complex than an
article.![]() |
TipYou don't need to create a
<map> for the screen media and a
<bookmap> for the print media. If you follow the
“one topic per XML file” rule, a single topic map
(<map> or <bookmap>
depending on the complexity of the contents) is all you need. |
<bookmap>
may have a <booktitle>
<title>
<bookmeta>
<topicmeta>
<topicref>
<part>
<chapter>
<appendix>
<frontmatter>
<backmatter>
<preface>
<dedication>
<colophon>
<frontmatter>
and
<backmatter>
is to contain the following, empty
placeholder elements: <toc>
<figurelist>
<tablelist>
<indexlist>
<bookmap>
for this
tutorial (contents of file tutorial-book.ditamap
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
<bookmap> <booktitle> <mainbooktitle>DITA for the Impatient</mainbooktitle> </booktitle> <bookmeta> <authorinformation> <personinfo>...</personinfo> <organizationinfo>...</organizationinfo> </authorinformation> <critdates> <created date="October 7, 2009"/> </critdates> </bookmeta> <frontmatter> <booklists> <toc/> <figurelist/> <tablelist/> </booklists> </frontmatter> <chapter href="introduction.dita"/> <chapter href="topics_and_maps.dita"/> <chapter href="topic.dita"> <topicref href="topic_structure.dita"> <topicref href="samples/sample_topic.dita" toc="no"/> </topicref> <topicref href="block_elements.dita"/> <topicref href="inline_elements.dita"/> <topicref href="link_elements.dita"/> </chapter> . . . <chapter navtitle="Topic maps"> <topicref href="map.dita"/> <topicref href="bookmap.dita"/> </chapter> <chapter href="conclusion.dita"/> </bookmap> |
<troubleshooting>
<screen>
<codeph>
<note>
<fn>
<lq>
<q>
<reltable>
<related-links>
<topicmeta>
<prolog>
(1) | Preferably using a DITA-aware XML
editor such as XMLmind XML Editor ![]() |
(2) | The
<body> element is optional too. However creating
a <topic> element having no
<body> child element is mainly a trick which is
more simply implemented by adding a <topichead> ![]() |
(3) | More about topic maps later in this tutorial. |
(4) | A less convenient
alternative would be to use an actual <topic>
having no <body> at all, just a
<title> . |