DocBook tags in OpenOffice.org

Contents

For the following instructions to work, ensure that the DocBook stylesheets have been enabled. See the User Guide if this has not already been done. Currently the stylesheets only support <article> and <chapter> as top-level elements.

The Stylist and Navigator also need to be displayed:

Press F11 to display the Stylist

Depending on the DocBook tag to be used, the following options are available:

Select either Custom Styles or All Styles in the Stylist combo-box

Click either the Paragraph Styles icon (first in the left on the Stylist) or the Character Styles icon (second from the left on the Stylist)

Press F5 to display the Navigator

The Headings tab can be expanded to navigate through the DocBook sections of the document.

To import an existing Article or Chapter

In the File Open dialog select the appropriate DocBook filter (Article or Chapter) in the File Type combo-box. An existing DocBook document can then be imported to OpenOffice.org.

To export an Article or Chapter

Similarly, in the File Save As dialog select the appropriate DocBook filter in the File Type combo-box.NOTE: It is possible with the current filter to import an article and export it as a chapter, or go from chapter to article.

Creating an Article or Chapter

It is possible to create and save a new DocBook document in OpenOffice.org.

Go to File -> Open

Select OpenOffice Text Document Template (*.stw) as the File Type

Open the DocBookTemplate.stw (downloaded when enabling the DocBook stylesheets)

Early in the DocBook project there were difficulties mapping nested DocBook XML elements to the internal OpenOffice.org XML format. An example of how nested tags are now supported is the menuchoice element that can contain several guimenu elements.

NOTE: This is the initial fix for the problem of nesting DocBook XML tags in OpenOffice.org. The main purpose was to retain the information on a round-trip import and export of a DocBook document. It is not ideally suited to creating DocBook content in OpenOffice.org.

Nesting Guimenus and Guimenuitem inside a Menuchoice

Press return to create a new paragraph

Go to Custom Character styles in the Stylist and select Guimenu

Enter the Guimenu text

Select Guimenuitem in the Stylist

Enter the Guimenuitem text

Highlight the Guimenu and Guimenuitem text

In the Insert Bookmark dialog enter the text menuchoice_0 and click OK

OpenOffice.org bookmarks with reserved names are used to represent the parent element when nesting tags. The convention used is to follow the element name by an underscore and a number. The first element in the document will be numbered 0 (e.g. menuchoice_0) and subsequent elements of the same type will increment this number (e.g. menuchoice_1 menuchoice_2 etc.). For another example of how to use nested tags, see Meta Information where an Authorgroup is used to contain Author's.

Initially the DocBook project used OpenOffice.org sections to enforce the nesting of DocBook sections. Feedback has shown that authors wish to use the common word processing styles such as Heading1, Heading2, etc. The following instructions describe how to create a <sect1> that contains a <sect2>

Select All Styles in the Stylist combo-box

Click the Paragraph Styles icon (first in the left on the Stylist)

Double-click the Heading 1 style

Enter the text to be the <sect1> title

All the text below this heading will now be the content of the DocBook <sect1>

Enter other DocBook styles, tables, etc.

Enter other DocBook styles, tables, etc. to be included in <sect1>

Double-click the Heading 2 style

Enter the text to be the <sect2> title

All the text below this heading will now be the content of the DocBook <sect2>

Enter other DocBook styles, tables, etc. to be included in <sect2>

This nesting of DocBook sect's using OpenOffice headings can go as far as <sect4> / Heading 4

Link, Ulink and Olink

How to create a MediaObject

How to create an Indexterm

If the document does not already contain any DocBook sections see Sections.

Highlight the section title

Go to Insert -> Indexes and Tables -> Entry...

Set Index to Alphabetical Index

Set 1st Key to the desired content of <primary>

Set 2nd Key to the desired content of <secondary>

Click Insert

NOTE: After discussions with authors the decision was made to only support simplified indexterms in the future. Few authors use spanning indexterms with startofrange and endofrange values or reference elements with a zone attribute.

How to create an Index

At present it is not possible to create a DocBook index in OpenOffice.org. However, the import and export filters should retain any index tags in an existing DocBook document.

Apache, the Apache feather logo, and OpenOffice are trademarks of The Apache Software Foundation.
OpenOffice.org and the seagull logo are registered trademarks of The Apache Software Foundation.
Other names appearing on the site may be trademarks of their respective owners.