CELL home page

Generating multiple outputs from a single source

A significant advantage of using XML to prepare sources for publication is that the encoding of the data does not predetermine the form of the output. A text encoded in XML can be transformed according to need:

Any changes or corrections need be made only to the XML source - they will be reflected in all the forms of output when the XML is transformed.

Diagram representing the transformation

Example: Letters to a Lady of Fortune

In our example, Letters to a Lady of Fortune, we have a single XML source, which is used to create both HTML files for on-line study and a PDF file for printing. The input XML conforms to a DTD designed specifically to encode letters with an introductory text and footnotes. A script written in the programming language Python. Python is used, because it is an open source, high level programming language with support for object orientation and the XML DOM model. transforms the input file into the required outputs:

Notes are handled as mouseover events in the HTML and as endnotes in the PDF.

Using our own DTD allows us to establish simple yet strict requirements for elements and attributes. This makes the transformation script easier to write and facilitates the checking of encoding of the input source. A further refinement of the script would provide a conversion of the input XML into an output file compatible with the TEI Guidelines for archiving.

Any number of input files could be transformed by the same transformation utility, provided they were encoded to conform to the DTD.

CELL home page