Introduction

Welcome to the GENE Graph Export Engine. GENE serves as a complex framework for multi-level XML transforming and exporting. Instead of a single XSLT transformation a complex directed graph of transformations is employed to gain the desired output. You have just to provide your semantic XML along with XSLT transformation to something GENE knows and specify what do you want as the output. GENE will do the rest: constructs a graph from known exporters and exports to your desired format.

There is an emerging standard on w3c called Xproc that is comparable to what GENE does. There are however these differencies:

  • GENE is intended to be a pure XML content transformer and exporter. No validations and/or XInclude resolution is supported, only XSLT nodes are supported.
  • The 'Tee' and 'if' nodes are performed automatically by GENE: document is automatically splitted into trees with nodes from same namespace (so-called nametrees). Each nametree is then processed by a XSLT that is intended to process such namespace.

It is best to describe the engine by an example. Let's have a XML document with our own XML document type that consists of text formatting elements and elements describing mathematical formulae. We want to transform this document to PDF using FOP. FOP accepts four kinds of input:

  • XSL-FO (the text-formatting objects XML document),
  • SVG (vector graphics),
  • Bitmap PNG and JPG images

How can we accomplish this task? We may transform the text-formatting elements directly to XSL-FO. However, we cannot directly render mathematics elements to SVG, PNG nor JPG. We may try to transform it into MathML and see what happens. Actually, there is a MathML renderer called JEuclid that is able to render MathML onto java.awt.Graphics. We can use Batik to capture drawing commands issued on the Graphics instance and convert it to SVG document. Now we can finally put together the XSL-FO and SVG documents and let them be processed by FOP.

This schema may be drawn as an oriented graph, containing three kinds of nodes:

  • The document source - node that provides the XML document,
  • Exporter - is able to convert document from one namespace to another namespace(s),
  • Coordinator - is able to receive exporters output and process it

In this example, the coordinator is a FOP processor as shown in this figure:

Figure 1: exporter graph
  • Black: the source document
  • Green: exporters
  • Red: coordinator
  • Blue: the coordinator output (PDF)
  • Grey arrow: a pipe connecting two exporters - document (or its part) is transferred through it

First, the exporter (XSLT script) produces document with two namespaces: the XSL-FO namespace and MathML namespace. XSL-FO is directly accepted by the coordinator, however MathML must be converted to SVG, PNG or JPG. This can be achieved by converting it to MathML (XSLT script), then to the java.awt.Graphics instance (JEuclid) and then to SVG (Batik) (or PNG - java.awt.ImageIO). These XSL-FO and SVG documents are transferred to Coordinator, which finally converts them (using FOP) to PDF.

User needs to provide Exporter instances only - the graph creation and transformations are performed by the engine.

You may find more info about GENE in javadoc and subpackages.