If you have any comments or suggestions for improving these tools, send an email to Daniel Owens at dh_owens@yahoo.com or send an email to the Sword Developer's Collaboration Forum at sword- devel@crosswire.org.

If you have any comments or suggestions for improving these tools, send an email to Daniel Owens at dh_owens@yahoo.com or send an email to the Sword Developer's Collaboration Forum at sword- devel@crosswire.org.

Synopsis

The OpenOffice to OSIS export filter uses an XSLT stylesheet, in conjunction with an OpenOffice Writer
template, to export documents from OpenOffice to OSIS XML (OSIS version 2.1.1) which can be used to
create Genbook modules for the Sword Library.

System requirements

Installation instructions

To install the filter, follow these steps:

Extract the contents of the oowriter2osis.zip archive.

Open OpenOffice Writer. In the File menu click on “Templates/Organize...” Right click on “My Templates” and click on “Import Template...” Navigate to the folder where you extracted the archive and double-click on OSISGenbook.ott. Click “Close” to close the “Template Management” window.

In the Tools menu click on “XML Filter Settings...” Click on “New...”

Enter the information below in the “General” tab:

Filter Name: OSIS GenBook

Application: OpenOffice.org Writer (.odt)

Name of File Type: OSIS XML Version 2.1.1

File extension: xml

In the “Transformation” tab enter the following information:

DocType: OSIS

XSLT for Export: (the path to “oowriter2osis.xsl”; this could be in ~/.openoffice.org2/user/

xslt/ or wherever you want it)

How to create an OSIS Genbook from OpenOffice Writer

In the OpenOffice Writer File menu click “New.../Templates and Documents/Templates/My Templates” and double-click on OSISGenbook. That will open an untitled document with the necessary styles.

Copy the text you want to be in the OSIS file and paste it into the new document and save it.

Before you start formatting, in the File menu click on “Properties.” In the “Description” tab enter the title of the module as the “Title” and the module name as the “Subject.” Click on the “User Defined” tab and enter the xml:lang code under “1: Info 1.” If you don't enter one the filter will designate English as the language of the module.

Now you can begin formatting. It is important to use the template provided because it is set up to work with the XSLT filter to create a properly formed OSIS document. The first thing you should do is apply paragraph styles for the major divisions in the module, such the book's title, chapters, etc. The hierarchy of divisions is defined in the Outline Numbering menu (Tools/Outline Numbering...) already in the template. These all correspond to OSIS div types except for x-unit, which provides a level of division between book and chapter. To apply a style, just click on the line to which you want to apply the style and double-click on the style in the Styles and Formatting window.

bookGroup (could be a collection of works by the same author)

book

x-unit

chapter

section

subSection

The rest of the paragraphs of the work should be the Default paragraph style. However, you can define certain character styles within all paragraph styles which will be exported with the appropriate OSIS elements. Supported character styles include:

Bold text

Italic text

Superscript text

Subscript text

In addition to text, the OSIS schema offers several features that are easily created in OpenOffice and exported with the proper OSIS elements. For images and Scripture references, follow the directions below to prepare your OpenOffice Document for export and your exported OSIS XML file for compiling.

Footnotes

Endnotes

Tables

Images: When you insert an image, right click on that image and click on “Picture...” Change the Name of the image to the filename, including the file extension. The template has an image named “crosswire.jpg”. Then copy the image to a folder named “images” and include that folder with the module.

osisRef: To designate a Scripture reference as such, in OpenOffice Writer you have to apply the character style “osisRef” to the whole reference, including the book name, chapter, and verse. The export filter creates the <reference> element and copies that reference to the osisRef attribute as it is written in the document. You have to run a Perl script on the exported xml file to achieve a valid osisRef. See step 8 below.

When your document is ready to export from OpenOffice, in the File menu click on “Export...” and in the “File Format” combo box choose “” and click “Export.” Now your OpenOffice Document is exported as an xml file.

If there are scripture references in the book, you should use the script “addosisrefs.pl” to make sure that osisRef's are handled correctly. Input reference formats that this script handles include the following: “Genesis 1,” “Genesis 1:1,” “Genesis 1-2,” and “Genesis 1:1-2:1.” References spanning multiple books need to be manually corrected. Also, Bible book names and abbreviations that are converted to OSIS abbreviations include only a select set of English names and abbreviations (see “Supported Bible Book Names.txt” for a list of supported names and abbreviations). To get command-line syntax and the output filename, simply open an terminal, navigate to the folder where the script is stored, type ./addosisrefs.pl, and press enter. If this doesn't work, make sure that Perl is installed.

Now your file should be ready to compile using xml2gbs. Be sure to include the folder “images” with any image files with your module.

Note: Not all features listed above display correctly in all the Sword front-ends, but the basic fundamentals should work.

Features requested but not yet supported

<foreign> element

<index> element

Current version number and date of release

Version 1.0, 2008-02-13

Comments and suggestions

If you have any comments or suggestions for improving these tools, send an email to Daniel Owens at dh_owens@yahoo.com or send an email to the Sword Developer's Collaboration Forum at sword- devel@crosswire.org.