Technical documentation

Preamble

This subsection will explain precisely how the conversion process works. If you are reading this, I assume you are be familiar with XML technologies seen in NF29 (i.e. ANT scripts, XSL-XSLT transformations and Opale format).

Besides, the converter has been tested on recent ANT versions (> 1.9.0) only. It needs ANT-contrib plugin and the Saxon XML parser Java library.

Project folder

The project folder :

  • /lib : contains the needed libraries (the XML parser Saxon and ant-contrib, an ANT library)

  • /out : destination of the converted output files

  • /source : folder where the user put its input file(s)

  • /XSLT : contains the XSL-XSLT program which performs the transformation

  • exOOOsToOpale.ant : the ANT file which launch the transformation for one or several files

Workflow of the converter

First of all the converter is launched using the indicated ANT file exOOOsToOpale.ant.

Then, this ANT file select the current ODT target file in the source folder and process some basic routines (rename, unzip, move) to get the XML content of the file (OpenDocument Format). Finally the ANT file launches the transformation using the XSL-XSLT program named odtToOpale_tat.xsl.

The converted files are directly saved in the out folder, and can be used in SCENARIChain.

Temporary files

During the transformation process we use some temporay files and folders. Because we need to unzip the ODT files, we need to move them and rename them before the unzip process. In the source folder, we create an unzip folder in which we will create all our temporay files and folders.

The ANT script

First of all, there are two ways to use the ANT script :

  1. Launch the transformation for a specific file

    Execute "ant -buildfile exOOOsToOpale.ant -DFilename=<myFile.odt>"

    [the transformation is launched for your specified file only]

  2. Launch the transformation for several files

    Execute "ant -buildfile exOOOsToOpale.ant"

    [the transformation is launched for all the .odt files in the source folder]

To handle the second way, we use the ANT-contrib library/plugin to go through all the ODT files in the source folder, and then launch the transformation on each files.

The transformation part is divided in two phases :

  1. The first phase manages the unzip phase of the file.

    First the ANT file rename the ODT file into a .zip file. Then it unzip the file to get access to the content.xml file which contains the data of the ODT file.

  2. The second phase launches the XSL-XSLT transformation using the exOOOsToOpale_tat.xsl file.

The XSL-XSLT transformation

In this part of the documentation, we will explain how we process the XSL-XSLT transformation.

First of all, we will describe the exOOOs format and more especially the cloze format.

exOOOs Format :

The main idea to understand is that the OpenDocument format handle the cloze format by using <draw:control>which are graphic elements. So they are manually placed by the creator of the file, they have a specific two dimension position (x and y). Each elements is linked to a macro element (form:text) which handles the control of the right response.

So these macros contains the answers of the quizz. The link between the macro and the control element is made via the draw:control parameter of the <draw:control> element. The value of this parameter is the id of the macro.

So we need to go through the XML file to find the answers associated for each <draw:control> elements.

The problem is to place the gap in each phrases because the position is graphical (two dimensions coordinates).

Actually in (almost) each phrases containing a gap there is a special space <text:s/>, just before the <draw:control>. So we use these spaces to localize the gaps in the text.

Opale Format :

In Opale a gap is defined by a <sc:textLeaf role="gap">{answer}</sc:textLeaf> element. With others specific imbrications of elements like <sc:gapText> or <op:clozeTxt>.