![]() | Text Encoding Initiative |
XSL stylesheets for TEI XML |
Home |
IntroductionThis is a set of XSLT specifications to transform TEI XML documents to HTML, and to XSL Formatting Objects. It concentrates on TEI Lite, but adding support for other modules is fairly easy, and I am working my way through the TEI as applications come along. In the main, the setup has been used on `new' documents, ie reports and web pages that I have authored from scratch, rather than traditional TEI-encoded existing material. This is release 1.6. There is a change log file available. The stylesheets have been tested at various times with the Microsoft, XT, Saxon, jd, libxslt, Xalan, Sablotron and Oracle XSLT processors; but at present the only ones which are known to work fully are Saxon and libxslt. The Microsoft processor can be used, but does not support multiple file output, which means that you cannot use the `split' feature of the stylesheets to make multiple HTML files from one XML file. There are ways to achieve the same effect, if you know what you are doing with some Javascript, as demonstrated in the teihtml-pagetable.xsl file. If you have not yet installed an XSLT processor, it is probably sensible to pick Mike Kay's Saxon (from http://saxon.sourceforge.net) or Daniel Veillard's libxslt (from http://www.xmlsoft.org), as they seem to be the best implementations of the specification. It is up to the user to find out how to run the XSLT processor! This may be from within a Java program, on the command-line, or inside a web server. I will be very glad to discuss details of these stylesheets with anyone. Contact me (Sebastian Rahtz) as sebastian.rahtz@oucs.ox.ac.uk Producing HTMLThe set of XSL styles for making HTML of files is as follows:
Making HTML: usageYou can simply refer to the specification http://www.oucs.ox.ac.uk/stylesheets/teihtml.xsl directly with your XSL processor, or install it locally on your own server. For more flexibility, you may prefer to reference the specifications from an XSL wrapper of your own. The minimal specification would look like this: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:import href="http://www.oucs.ox.ac.uk/stylesheets/teihtml.xsl"/> </xsl:stylesheet>We will see shortly how we can customize the result by adding to this wrapper file. The default result will be a single HTML file. You can also configure it to produce multiple output files, one per top-level <div>, <div0>, or <div1>. The top-level file will be called, by default, index.html. Important Note: If you use Saxon or libxslt processors, you will get nothing on standard output by default, as they use the EXSLT extensions to XSLT to generate the top-level file by name. For other processors, the top-level file will come out on standard output or wherever the processors writes by default. Making HTML: customizationThe TEI HTML stylesheets are designed to be customized, and I will gladly add more parameterization in future. There are currently about over 60 things you can set to change the output, described below. 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. There is a web form at http://www.tei-c.org.uk/tei-bin/stylebear which will construct a nice XSL file for you, with all the variables configured. There follows a list of all the things you can override in an .xsl file which imports teihtml.xsl or teihtml-slides.xsl. Where the variable is boolean (ie can be `true' or `false'), it works by assuming `true' if there is any value. Make the variable empty to assert `false'. param.xml How does this work in practice? Here is a real wrapper style sheet, customized for formatting a TEI document: <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version="1.0"> <xsl:import href="http://www.oucs.ox.ac.uk/stylesheets/teihtml.xsl"/> <xsl:param name="masterFile">teiu5</xsl:param> <xsl:param name="cssFile">http://www.oucs.ox.ac.uk/stylesheets/tei.css</xsl:param> <xsl:param name="alignNavigationPanel">center</xsl:param> <xsl:param name="topNavigationPanel"></xsl:param> <xsl:param name="bottomNavigationPanel">true</xsl:param> <xsl:param name="institution">Text Encoding Initiative: TEI Lite</xsl:param> <xsl:param name="homeURL">http://www.tei-c.org.uk/</xsl:param> <xsl:param name="homeWords">TEI at Oxford</xsl:param> <xsl:param name="parentURL">http://www.tei-c.org/</xsl:param> <xsl:param name="parentWords">TEI Consortium</xsl:param> <xsl:param name="feedbackURL">http://www.tei-c.org.uk/Lite/</xsl:param> <xsl:param name="feedbackWords">TEI Lite</xsl:param> <xsl:param name="searchURL"></xsl:param> <xsl:param name="searchWords"></xsl:param> <xsl:template name="logoPicture"> <img src="jaco001d.gif" alt="" width="180" /> </xsl:template> <xsl:param name="useIDs"></xsl:param> <xsl:template name="copyrightStatement"> Copyright TEI 1995 </xsl:template> </xsl:stylesheet>You can see the results at /Lite/teiu5.html, the TEI Lite specification. The CSS fileThe following table lists all the CSS `class' attributes used in HTML output; you can change all of these in the associated .css file:
PDF outputThese style sheets were developed for use with PassiveTeX (../Software/passivetex/), a system using XSL formatting objects to render XML to PDF via LaTeX. As an example of its use, see teiu5.pdf, the TEI Lite guidelines.
Or zipped-up in teixsl-fo.zip for convenient download.
|