The PDF version of this tutorial is available at: http://www.syntext.com/products/serna/doc/dita-tutorial/dita-serna-tutorial.pdf
Copyright © 2007 Syntext, Inc.
Table of Contents
List of Tables
This tutorial helps you get handy with DITA authoring in Serna. You'll learn to create topics and integrate them into a map, make links, and reuse content by means of content references. In the tutorial, you will also find information about publishing DITA documents and about available views of DITA documents in Serna. For general things, such as element insertion, cursor placement, selection, navigation, etc, refer to the Syntext Serna Basics Tutorial.
To read this tutorial, you are supposed to have a general understanding of basic DITA concepts. For the introduction to DITA, see http://en.wikipedia.org/wiki/DITA.
All versions of Serna support DITA. However, the DITA usability tools, which facilitate the insertion of common DITA constructs, are available in the Enterprise edition and the trial version of Serna only.
Table of Contents
Abstract
DITA documents can be of different types, e.g. concept, task, reference, etc. In this section, we'll create a concept and a task, and we'll use these topics later in the tutorial when we deal with a DITA map, linking and content referencing.
Let's create a "Color Temperature" concept:
Choose -> to call the New Document Dialog.
Select DITA 1.1 -> Concept .
In the
File Name
field, specify the path to the new file color-temperature.xml: D:/dita-examples/color-temperature.xml.
You can use the button to specify the new file location.
Click .

A new document color-temperature.xml will be created. Put the cursor inside the p element.

Type about the concept of color temperature:
Colors are said to be warm or cool.
Change the title from "Concept" to "Color Temperature".

Save color-temperature.xml.
Let's create a "Drawing a Rainbow" task:
Choose -> to call the New Document Dialog.
Select DITA 1.1 -> Task .
In the
File Name
field, specify the path to the new file draw-rainbow.xml: D:/dita-examples/draw-rainbow.xml.
You can use the button to specify the new file location.
Click .

A new document draw-rainbow.xml will be created.

Make 7 steps and type inside the cmd elements:
Draw a red arc. Draw an orange arc. Draw a yellow arc. Draw a green arc. Draw a blue arc. Draw an indigo arc. Draw a violet arc.
Change the title from "Task" to "Drawing a Rainbow".

Save draw-rainbow.xml.
A DITA map lets you organize topics for a particular output. You can aggregate any of the existing topics by means of topic references (topicrefs) and set relationships between them.
Now that we have a concept and a task, let's create a map:
Choose -> to call the New Document Dialog.
Select DITA 1.1 -> Map .
In the
File Name
field, specify the path to the new file colors.ditamap: D:/dita-examples/colors.ditamap.
You can use the button to specify the new file location.
Click .

A new DITA map document will be created.

Select the "DITA Map" text of the title and change it to "Colors".

Now the title says "Colors".

Let's insert references to the "Color Temperature" and "Drawing a Rainbow" topics:
Click the
Insert Topic Reference
button
to call the Insert Topic Reference Dialog.
In the Insert Topic Reference Dialog, do the following:
Select the file color-temperature.xml and the target "Color Temperature" concept.

From the Type drop-down list, select "concept" to display the type of the referenced topic.

Click the button.
Select the file draw-rainbow.xml and the target "Drawing a Rainbow" task.

From the Type drop-down list, select "task" to display the type of the referenced topic.

Click the button.
Click the button.
The topic references (topicrefs) have been inserted. The titles are extracted from the referenced topics and you see the links to the documents. Also, the types of the topics are shown: a concept and a task.

Save colors.ditamap.
Above, we inserted references to existing topics. It is also possible to create new DITA documents and simultaneously insert references to these newly created documents in DITA Map.
Let's insert two more references to documents which do not exist yet: "Warm Colors" Concept and "Cool Colors" Concept.
Let's nest the reference to a newly-created "Warm Colors" concept in the "Color Temperature" topic reference:
Put the cursor in the "Color Temperature" topic reference.

Click the
Insert New DITA Document Reference
button
to call the Insert New DITA Document Reference Dialog.
Set properties for the new DITA topic:
In the Insert New DITA Document Reference Dialog, do the following:
From the Template drop-down list, select Concept.
In the Title field, type: "Warm Colors"". Note that the Id field gets filled in automatically: warm-colors.
In the
File
field, specify the path to the new file warm-colors.xml: D:/dita-examples/warm-colors.xml.
You can use the button to specify the new file location.
Check the Open after insert checkbox.
Click the button.

The topic reference (topicref) to the "Warm Colors" concept has been nested.

A new document warm-colors.xml has been created and opened. The concept already has the title "Warm Colors" and the ID warm-colors.
Put the cursor inside the p element.

Type about the concept of warm colors:
Such energetic colors as red, orange and yellow are associated with sunlight. That's why they are often called "warm colors".
You should get a "Warm Colors" concept like this:

Save warm-colors.xml.
Save colors.ditamap.
Let's nest the reference to a newly-created "Cool Colors" concept in the "Color Temperature" topic reference:
Put the cursor after the "Warm Colors" topic reference. It is convenient to click this position in the ContentMap.

Click the
Insert New DITA Document Reference
button
to call the Insert New DITA Document Reference Dialog.
Set properties for the new DITA topic:
In the Insert New DITA Document Reference Dialog, do the following:
From the Template drop-down list, select Concept.
In the Title field, type: "Cool Colors"". Note that the Id field gets filled in automatically: cool-colors.
In the
File
field, specify the path to the new file cool-colors.xml: D:/dita-examples/cool-colors.xml.
You can use the button to specify the new file location.
Check the Open after insert checkbox.
Click the button.

The topic reference (topicref) to the "Cool Colors" concept has been nested.

A new document cool-colors.xml has been created and opened. The concept already has the title "Cool Colors" and the ID cool-colors.
Put the cursor inside the p element.

Type about the concept of cool colors:
Such soothing colors as green, blue and violet are associated with winter, rain and ocean. That's why they are often called "cool colors".
You should get a "Cool Colors" concept like this:

Save cool-colors.xml.
Save colors.ditamap.
Let's display the type of the "Warm Colors" topic:
Click the "Warm Colors" topic reference.

Click the
Insert Topic Reference
button
.
In the Change Topic Reference Dialog, select "concept" from the Type drop-down list.

Click the button. Click .
Now the type of the "Warm Colors" topic is shown.

Save colors.ditamap.
Let's specify the collection type of the referenced concepts to describe the relationship between them:
Click the "Color Temperature" topic reference.

Click the
Insert Topic Reference
button
.
In the Change Topic Reference Dialog, select "family" from the Collection Type drop-down list.

Click the button. Click .
Now the "family" collection type of the concepts is specified.

Save colors.ditamap.
Let's switch to the map view that displays resolved topic references:
From the XSLT Parameter Set drop-down list, select Show Resolved .

Now the map displays the content of the referenced topics.

You can't edit the content of topics right in the map. Double-click a topic in the map to open it as a separate document.
For a summary of XSLT Parameter Sets for DITA, see Appendix A, DITA XSLT Parameter Sets.
Abstract
In this section we'll learn to make different types of links to targets with IDs: local and external xref and related links.
Let's insert a local xref in the "Drawing a Rainbow" task:
Open draw-rainbow.xml.

Add the ID attribute to the first step element "Draw a red arc.".

After the steps element, insert the postreq element and type inside it:
You can remember the colors as ROY G BIV.
Let's make the letter "R" a local xref to the first step "Draw a red arc." Place the cursor before the letter "R".

Choose ->.

In the Insert Local Xref Dialog, select the target step. Check the Close on Insert checkbox. Click the button.

A local xref to the first step "Draw a red arc." has been inserted.

Now cut the letter "R" and paste it in the xref.

Save draw-rainbow.xml.
Let's insert an external xref in the "Drawing a Rainbow" task:
Open draw-rainbow.xml.
In the first step after the cmd, insert info-> note-> p elements.
Type inside the p:
Red is a warm color. For details, see .

Choose ->.

In the Insert External Xref Dialog, select the file warm-colors.xml and the target "Warm Colors" concept. Click the button.

The external xref to warm-colors.xml has been inserted.

Save draw-rainbow.xml
Let's insert an external related link in the "Drawing a Rainbow" Task:
Open draw-rainbow.xml.
Choose ->.

In the Insert External Related Link Dialog, select the file color-temperature.xml and the target "Color Temperature" concept. Click the button.

The external related link to the concept of color temperature has been inserted.

Save draw-rainbow.xml.
Abstract
In this section we'll learn to work with local and external content references (conrefs) that provide a powerful mechanism for content reuse. Conref is an attribute of an element that pulls the content into the element from another element of the same type. Any element with an ID can be reused by means of a conref.
When you need to insert a conref, Serna creates an element automatically together with the conref attribute that pulls the content into the element.
Let's create a local content reference in the "Warm Colors" concept:
Open warm-colors.xml.

After the p element, insert a note with a p.

Type inside the p:
The irony is that the hottest bodies radiate with a cool color while the less hot bodies radiate with a warm color.

Add the ID attribute to the note.

Put the cursor after the note.

Choose ->.

In the Insert Local Conref Dialog, select the target note. Click the button.

The local content reference has been inserted.

Type more text in the original note:
For example, a red dwarf star has a relatively low surface temperature, while a blue giant star has the warmest surface.
and see the changes applied to the local conref.

Save warm-colors.xml.
Let's create an external content reference in the "Cool Colors" concept:
Open cool-colors.xml.
Put the cursor after the p element.

Choose ->.

In the Insert External Conref Dialog, do the following:
Select the file warm-colors.xml.
Select the target note.

Click the button.
The external content reference has been inserted and resolved.

Despite the fact that external conrefs can be resolved, their content can't be changed. However, you can edit the conref attribute itself: right-click the element and select Element Attributes from the context menu. In the Element Attributes Dialog, you can change the value of the conref attribute (change the path to the target element).
Save cool-colors.xml.
Open cool-colors.xml where we inserted a note as an external conref.

The default document view profile displays resolved content references, so the note inserted by means of a conref looks like an ordinary note in the editing window.
To make the conref distinguishable in the editing window, switch to another document view profile:
From the XSLT Parameter Set drop-down list, select Edit Conrefs .

The external conref is highlighted with blue and you see the path to the original note.

Despite the fact that external conrefs can be resolved, their content can't be changed. However, you can edit the conref attribute itself: right-click the element and select Element Attributes from the context menu. In the Element Attributes Dialog, you can change the value of the conref attribute (change the path to the target element).
For a summary of XSLT Parameter Sets for DITA, see Appendix A, DITA XSLT Parameter Sets.
DITA documents can be published to HTML and PDF format.
DITA documents are published with DITA Open Toolkit V1.4 that requires installation of Java not older than J2SE v 1.4.2_08:
Installing Java on Windows:
Download J2SE v 1.4.2_08 JRE at http://java.sun.com/products/archive/j2se/1.4.2_08/index.html.
Install J2SE v 1.4.2_08 JRE.
Set the environment variable for JAVA_HOME.
From the , select >->.
Double-click System to open the System Properties window.
On the Advanced tab, click Environment Variables .
Click under the System variables section.
Type JAVA_HOME in the
Variable name
field.
Type <JAVA_INSTALL_PATH>\j2re1.4.2_08 in the
Variable value
field.
Click .
The instructions are given for Classic Start menu and Classic View of Control Panel.
Installing Java on Linux:
Download J2SE v 1.4.2_08 JRE at http://java.sun.com/products/archive/j2se/1.4.2_08/index.html.
Install J2SE v 1.4.2_08 JRE.
Set the environment variable for JAVA_HOME.
Let's publish colors.ditamap:
Open the document in Serna.

Click the Publish button
on the toolbar (or press Ctrl-P, or choose ->).
In the Publish Dialog:
From the Publishing output drop-down list, select HTML DITA Map.
Click and wait until the script ends.

Click and the generated HTML DITA Map file will be opened in your browser.
Click the link "Cool Colors".

The file will be opened.

We touched upon XSLT Parameter Sets in the section called “Resolving Topic References in Map”and the section called “Making Conrefs Explicit”, where we switched between the sets to change the view of a document.
This appendix deals with specifics of DITA XSLT Parameter Sets only. For general information about what an XSLT Parameter Set is, how to switch between sets, edit and save them, please see the Syntext Serna Basics Tutorial, Chapter 4. XSLT Parameter Sets.
The following table provides a summary of XSLT Parameter Sets available for all DITA topics, i.e. Topic, Concept, Task, Reference, Composite and Glossary.
Table A.1. DITA Topics XSLT Parameter Sets
| XSLT Parameter Set | Effect |
|---|---|
| Default View | Resolves conrefs; Displays prologs. |
| Hide Prolog | Hides prologs. |
| Edit Conrefs | Displays unresolved conrefs highlighted with blue; Displays the path to the target element (the value of the conref attribute). |
The following table provides a summary of XSLT Parameter Sets available for DITA maps, i.e. Map and Bookmap.
Table A.2. DITA Maps XSLT Parameter Sets
| XSLT Parameter Set | Effect |
|---|---|
| Default View | Displays titles extracted from referenced topics and links to topics (unresolved topicrefs); Resolves conrefs. |
| Show Descriptions | Displays the shortdesc information of referenced topics. |
| Show Resolved | Resolves topicrefs showing the content of referenced topics. |
| Edit Conrefs | Displays unresolved conrefs highlighted with blue; Displays the path to the target element (the value of the conref attribute). |