Introduction
This 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 2.1. 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 HTML
The set of XSL styles for making HTML of files is as follows:
Or zipped-up in teixsl-html.zip for convenient download.
Making HTML: usage
You 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: customization
The 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'.
IntroductionType | Name | Default | Comment | param | teixslHome | http://www.oucs.ox.ac.uk/stylesheets/ | Location of master files |
Structuring the outputType | Name | Default | Comment | param | masterFile | index | Output file | param | inputName | | Input filename | param | outputDir | | Output directory | param | splitLevel | -1 | Splitting level | param | splitBackmatter | true | Split back matter | param | splitFrontmatter | true | Split front matter | param | sectionTopLink | | Put link to top after each section | param | useIDs | true | Use ID attributes to name files | param | makingSlides | | Make slides |
Table of contents generationType | Name | Default | Comment | param | autoToc | true | Create table of contents | param | tocDepth | 5 | Table of contents depth | param | subTocDepth | -1 | Level of division for mini TOC | param | tocFront | true | Whether TOC shows front matter | param | tocBack | true | Whether TOC shows back matter |
Standard page featuresType | Name | Defa
ult | Comment | template | logoPicture | <a target="_top" href="http://www.ox.ac.uk/"><img border="0" width="78" height="94"
src="http://www.oucs.ox.ac.uk/images/ncrest.gif"
alt="Oxford University"/></a> | The HTML which will be placed in the top left corner of
the page to make a logo | param | cssFile | /stylesheets/tei-oucs.css | The CSS file which is to be used | param | feedbackURL | mailto:feedback | An email address for feedback | template | feedbackWords | Feedback | The label for feedback link | param | homeURL | http://www.oucs.ox.ac.uk/ | Site's home page | param | homeLabel | Home | Label for link to Home page | param | noframeWords | No Frames | Words to use on a page indicating that frames cannot be
used | param | homeWords | OUCS | Label of site home page | param | institution | Oxford University Computing Services | The institution | param | department | | The department | param | parentURL | http://www.ox.ac.uk/ | Parent institutional home page | param | parentWords | Oxford University | Label of parent institutional home page | param | searchURL | http://wwwsearch.ox.ac.uk/cgi-bin/oxunit?oucs | Link to search page | template | searchWords | Search | Label of search button | param | topNavigationPanel | true | Make a navigation panel at the top of the page | param | bottomNavigationPanel | true | Make a navigation panel at the bottom of the page | param | alignNavigationPanel | right | Alignment of navigation panels | param | linkPanel | true | Make a panel of standard links at the bottom of the page | template | copyrightStatement | <a
href="/documentation/copyright.html">©</a> Oxford
University Computing Services. | Copyright statement |
Frames and other navigation aidsType | Name | Default | Comment | param | makePageTable | | Whether to make each page a full-scale
table, with the first column containing links etc | param | leftLinks | | Whether to make each page a table, with the first
column being a set of standard links | param | rightLinks | | Whether to make each page a table, with the last
column being a set of standard links | param | linksWidth | 15% | Width of links column | param | makeFrames | | Whether to construct a frames
version of the document | param | frameCols | 200,* | Width of frames | param | frameAlternateURL | | alternate URL for noframes | template | logoFramePicture | <a class="framelogo" target="_top" href="http://www.ox.ac.uk">
<img src="http://www.oucs.ox.ac.uk/images/ncrest.gif"
vspace="5" width="90" height="107" border="0"
alt="University Of Oxford"/></a> | Logo for menu frame | param | sectionUpLink | | Add link after each section to the top of the document | template | topLink | <p>[<a href="#TOP">Back to top</a>]</p> | Link to top of document |
Choosing wordsType | Name | Default | Comment | param | appendixWords | Appendix | The word for appendix | param | tocWords | Contents | Title of a table of contents | param | upWord | Up | How to label an up link | param | nextWord | Next | How to label a `next' link | param | previousWord | Previous | How to label a `previous' link | template | contentsWord | Contents | How to label a `contents' link | param | dateWord | Date: | How to label the date | param | authorWord | Author: | How to label the author |
StyleType | Name | Default | Comment | param | divOffset | 2 | The mapping between div and h* | param | numberHeadings | true | Number headings | param | numberFrontHeadings | | Number headings in front matter | param | numberBackHeadings | true | Number headings in back matter | param | prenumberedHeadings | | Use supplied numbering in n attribute | param | headingNumberSuffix<
/em> | .<xsl:value-of select="$numberSpacer"/> | Suffix for section numbers | param | numberSpacer | <xsl:text> </xsl:text> | Suffix for section numbers | param | numberHeadingsDepth | 9 | lowest depth at which sections are numbered | param | fontURL | span | Font used for URLs | param | tableAlign | left | Table alignment | param | cellAlign | left | Table cell alignment | param | showTitleAuthor | | Show titles, dates and authors | param | footnoteFile | | Make footnote file | param | minimalCrossRef | | Include headings in cross-refs |
GraphicsType | Name | Default | Comment | param | graphicsPrefix | | Graphics file prefix | param | graphicsSuffix | .jpg | Graphics file suffix | param | showFigures | true | Show figures |
HooksType | Name | Default | Comment | template | bodyHook | | Hook at start of body | template | bodyJavaScript | | Hook to specify JScript functions | template | headHook | | Hook to add code to the HTML head | template | searchbox | | Hook to add code to the HTML head |
Miscellaneous and advancedType | Name | Defau
lt | Comment | template | rendSeparator | ; | Separator for multi-valued rend attributes | param | verbose | | Be verbose | param | downPicture | http://www.oucs.ox.ac.uk/images/down.gif | Slide spacing image | param | useHeaderFrontMatter | | Take front matter from teiHeader | param | outputEncoding | iso-8859-1 | Output encoding | param | REQUEST | | URL of current file | param | ID | | Document ID subset | param | rawIE | | Whether delivering raw XML to IE 5/6 | template | numberBodyDiv | <xsl:param name="minimal"/>
<xsl:if test="not($numberHeadings='')">
<xsl:number level="multiple"
count="div|div0|div1|div2|div3|div4|div5|div6"/>
</xsl:if> | How to number body divisions | template | numberFrontDiv | <xsl:param name="minimal"/>
<xsl:if test="not($numberFrontHeadings='')">
<xsl:number level="multiple"
count="div|div0|div1|div2|div3|div4|div5|div6"/>
<xsl:if test="not($minimal)"><xsl:value-of select="$numberSpacer"/></xsl:if>
</xsl:if> | How to number front matter divisions | template | numberBackDiv | <xsl:param name="minimal"/>
<xsl:if test="not($numberBackHeadings='')">
<xsl:number format="A.1.1.1.1.1"
level="multiple" count="div|div0|div1|div2|div3|div4|div5|div6"/>
<xsl:if test="not($minimal)"><xsl:value-of select="$numberSpacer"/>
</xsl:if>
</xsl:if> | How to number back matter divisions |
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 file
The following table lists all the CSS `class' attributes used in
HTML output; you can change all of these in the associated .css file:
box | Paragraph of type `box' |
department | Name of department in main page title |
epigraph | <div> containing an
<epigraph> |
framelogo | Link to logo file |
framemenu | Body of frame containing menu |
framemenudepartment | Department name in menu frame |
framemenuinstitution | Institutional name in menu frame |
framemenutitle | Document title in menu frame |
frametoc | Text in menu frame |
header | Table containing header |
footer | <div> containing header |
institution | Name of institution in main page title |
leftlinks | Style of table when extra link column is used |
maintitle | Document title in main page title |
navlink | Next, Previous, and Up links
|
notelink | Link to a note |
ptr | Link generated from TEI <ptr> |
ref | Link generated from TEI <ref> |
rightlinks | Style of table when extra link column is used |
subtoc | Class of HTML `div' for per-section table of contents |
subtochead | Heading of per-section table of contents |
teidiv | Wrapper around each section contents |
toc | List and items in table of contents |
xref | Link generated from TEI <xref> |
xptr | Link generated from TEI <xptr> |
PDF output
These 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.
The XSL files are as follows:
Or zipped-up in teixsl-fo.zip for convenient download.
|