Emle - XML Transform Overview

This document gives an overview of how Emle transforms a lab element within an XML file into HTML content using emle_lab.xsl.

Lab Element

A lab is an XML element normally in its own file that is expanded using XSLT. Specifically, equipment and instruction elements are specified within a lab. For example, Lab-1 references Equipment-17 and Instructons-1.

The equipment and instruction elements can be placed direclty inside a lab element or they may be placed in a stand alone XML file by using the refid attribute. This allows one to reuse content by creating it in a stand alone file then reference it by name rather than using copy and paste with an editor.

Equipment Element

A stand alone equipment elements are defined in XML files that are expanded to create HTML and SVG content with references to JavaScript functions which are definded in emle_lab.js. By convention the equipment elements are number. The numbering is independent of the lab element that uses it. This is because an equipment element may be and is expected to be used in more than one lab.

There are three major items that are normally in an equipment XML element: 1) text, 2) SVG graphics and 3) controls.

Text Elements

There are several text elements such as pretext and posttext which reference message identifiers which are embedded inside with HTML tags. The message identifiers are defined in language specific XML files which contain no HTML markup.

Graphic Element

Graphic elements have attributes like graphicType which for example can specify a rectangle or a circle. Additionally, attributes may specify whether the shape is to be segmented or not.

Control Element

Control elements are transformed into HTML fragments such as a form with two sets of radio buttons for denominator and numerator values. Control element attributes include minimum and maximum values for the radio buttons.

The control element may be nested inside a graphic which provides the user with input buttons to change values. For example, the display of a pie chart graphic segmented for representing a fraction. So, the user could select 3 from the numerator buttons and 4 from the denominator buttons which invoke a JavaScript function that displays a pie chart with 3 of the 1/4 segments shaded and would leave the 4th one blank. If the user were to change the denominator button selected from 4 to 3 then the pie chart would be divided into only 3 segements rather than the former 4 with all of the 1/3 segments shaded.

Instruction Element

Now returning to the description of the lab element which normally references an instruction element. These instruction elements are defined in separate XML files for each instruction by reference number. The XML file is an HTML fragment with HTML tags and text content. A single XML file contains a single instruction element which has the HTML markup with message reference identifiers for the text strings. The convention is for labs and instruction elements to be numbered with the number matching. For example, emle_instructions_1.xml has the instructions for Lab1 (emle_lab_1.xml).

Language Catalog

The text message elements for a language are all contained in a single message file by language (emle_lang_en.xml and emle_lang_es.xml). These message text elements are used in lab, equipment text, and instruction elements.

Simplified Example

There is a fourth element commnonly used in an equipment element which is the value element. This is used as glue to connect the other elements togther as shown in the simplified example below.
lab 1
  title
    msg lab-1-title
  equipment    17
  instructions 1


equipment 17
  title
    msg equipment-17-1
  value
   pretext
     html:p
       msg equipment-17-2
   graphic
       -graphicType  EMLE_GT_RECTANGLE
       -segmentation EMLE_GST_SOLID
       -height       101
       -width        250
     value
       control
           -enable EMLE_CET_PROPER_FRACTION
           -order  EMLE_COT_ASCENDING_BY_COMPONENT
         numerator
             -min 1
             -max 1
         denominator
             -min 1
             -min 8
   value
     pretext
       html:p
         msg equipment-17-3
     graphic
         -graphicType  EMLE_GT_RECTANGLE
         -segmentation EMLE_GST_SOLID
         -height       101
          -width        250
       value
         control
             -enable EMLE_CET_PROPER_FRACTION
             -order  EMLE_COT_ASCENDING_BY_COMPONENT
           numerator
               -min 1
               -max 1
           denominator
               -min 1
               -max 8

Modified 7-Jun-2009.