A TEI Project

XSL stylesheets for TEI XML

Table of contents

1. Introduction

This is a set of XSLT 2.0 specifications to transform TEI XML documents to XHTML, to LaTeX, to XSL Formatting Objects, to/from OOXML (docx), to/from OpenOfice (odt) and to ePub format. The files can be downloaded from the Releases area of http://tei.sf.net. They concentrate on the simpler TEI modules, but adding support for other modules is fairly easy. In the main, the setup has been used on ‘new’ documents, ie reports and web pages that have been authored from scratch, rather than traditional TEI-encoded existing material.

There is a change log file available.

The XSL FO style sheets were developed for use with PassiveTeX (http://projects.oucs.ox.ac.uk/passivetex/), a system using XSL formatting objects to render XML to PDF via LaTeX. They have not been extensively tested with the other XSL FO implementations.

2. File organisation

The main stylesheets are divided into four directories:
common2
templates which are independent of output type
fo2
templates for making XSL FO output
xhtml2
templates for making HTML output
latex2
templates for making LaTeX output
Within each directory there is a separate file for the templates which implement each of the TEI modules (eg textstructure.xsl, linking.xsl, or drama.xsl); these are included by a master file tei.xsl. This also includes a parameterization layer in the file tei-param.xsl, and the parameterization file from the common directory. The tei.xsl does any necessary declaration of constants and XSL keys.
There are four further directories for special-purposes conversions:
epub
conversion to ePub
oo
conversion to and from OpenOffice Writer format
docx
conversion to and from Word OOXML format
odds2
processing of TEI ODD files

The final important directory is profiles, which has a set of predefined project starting points (currently ‘default’, ‘iso’ and ‘enrich’), each of which may have a file to.xsl for each of the supported output formats (csv, dtd, html, oo, docbook, epub, latex, p4, docx, fo, lite, and relaxng). There may also be a from.xsl to go from the selected format to TEI XML.

For example, to convert TEI to HTML in the default mannner, the user may run profiles/default/html/to.xsl on the selected input file. Other starting points are listed below.

For the brave, there are Linux command-line shell scripts docxtotei, teitodocx, teitoepub, teitolatex, teitoodt, and odttotei, for converting to OpenOffice, LaTeX, ePub, and Word; and from Word and OpenOffice.

Any other use of the stylesheets, eg by referencing individual modules, is not supported and requires good understanding of XSL.

3. Documentation of generic start points

4. Documentation of start points for ENRICH manuscript description customization

5. Documentation of start points for ISO customization

6. Customization

The TEI stylesheets are designed to be customized, and I will gladly add more parameterization in future. There are currently several hundred things you can set to change the output, described in the Customization Handbook. They are either XSLT variables, or named templates, so you need to understand a little of XSL syntax. If you know a bit more, you can override any of the templates in the style files, but then you are on your own.

The Stylebear web form will construct a XSL file for you, with all the variables configured.

7. XSLT processors

The stylesheets have been tested at various times with the Microsoft, XT, Saxon, jd, libxslt, Xalan, Sablotron and Oracle XSLT processors; they were converted to use XSLT 2.0 in 2009, and so now only work with Saxon (from http://saxon.sourceforge.net). XSLT 1.0 stylesheets are also available, but will not be further maintained. It is up to the user to find out how to run the XSLT processor! This may be from within a Java program, from your editor, on the command-line, or inside a web server.

Sebastian Rahtz. Date: 2010-02-12
This page is copyrighted