XSL stylesheets for TEI XML

Table of contents

1. Introduction

This is a family of XSLT 2.0 stylesheets to transform TEI XML documents to various formats, including XHTML, LaTeX, XSL Formatting Objects, ePub, plain text, RDF, JSON; and to/from Word OOXML (docx) and OpenOfice (odt). They concentrate on the core TEI modules which are used for simple transcription and ‘born digital’ writing. It is important to understand that they do not:

and should not be treated as the definitive view of the TEI Consortium.

2. Profiles

The stylesheets support a set of profiles, which are redefined project starting points. They are implemented as a set of directories each of which may have a file to.xsl for one or more of the supported output formats (csv, docbook, docx, dtd, epub3, epub, fo, html5, html, ibooks, json, latex, lite, oddhtml, odt, p4, rdf, relaxng, tcp, txt, and xlsx). There may also be a from.xsl to go from the selected format to TEI XML.

3. Using the stylesheets

The stylesheets are embedded in various services, or can be used on their own to perform the transformations.

3.1. oXygen editor

The stylesheets are available for immediate use in the oXygen XML editor, if you have the TEI framework installed (it is enabled by default). This will make various transformations available immediately for documents which are detected as TEI. You set up a transformation by pressing the icon which looks like this: . The first time you do this, you should be offered a choice of built-in options:
.
From these, tick (for example) the box by ‘TEI P5 XHTML’ and click on Apply associated.

The transformation is run, and the default web browser is fired up with the resulting web page.

If you want to make sure you keep up with the latest versions of these stylesheets, and the TEI P5 schemas, you can subscribe to the TEI addon (maintained by the TEI Consortium) for oXygen. Go to Add-ons section of oXygen's Preferences and add http://www.tei-c.org/release/oxygen/updateSite.oxygen to the list. Then go to Help/Manage add-ons and activate the TEI P5 + XSL entry. After a restart, you'll be using the latest version in preference to what is delivered with your copy of oXygen. When updates appear, you'll be asked if you want to install them.

3.1.1. Rolling your own in oXygen

In addition to editing the copy of the stylesheets in oXygen, you can set up a copy of TEI framework, and configure oXygen to look at it. First, grab the current oXygen TEI framework by downloading the big zip file from http://code.google.com/p/oxygen-tei/downloads/list. Create a directory in your own directory area called oxygenframeworks and unpack the zip file into there.

Start up oXygen, and go to Preferences/Global and scroll down on the right to ‘Use custom frameworks’, and put in your frameworks directory.

Restart oXygen, and check that TEI support is still there. You can now edit your copy of the stylesheets, by creating (for example) a new profile directory, in tei/xml/tei/stylesheet/profiles. For example, to create your local profile for Word to TEI, create and a directory called local, and under that one called docx. In there, create a file called from.xsl which looks like this:
<xsl:stylesheet version="2.0exclude-result-prefixes="w"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">  <xsl:import href="../../default/docx/from.xsl"/> </xsl:stylesheet>
Edit that accordingly, and then choose the local profile in oXygen transformations.

3.2. OxGarage web service

OxGarage1 is a web, and RESTful, service to manage the transformation of documents between a variety of formats. The majority of transformations have the TEI format as a pivot format, using these stylesheets.

There are instances of OxGarage at http://www.tei-c.org/ege-webclient/ and http://oxgarage.oucs.ox.ac.uk:8080/ege-webclient note that the latter is not a fully-supported service, so please do not rely on it for production use.

OxGarage is open source, and runs as a Java servlet. A Debian package is available at http://tei.oucs.ox.ac.uk/teideb/. Source code is on Github at https://github.com/sebastianrahtz/oxgarage.git

To use OxGarage, got to the web site, click on Documents and select TEI P5 XML Document as your input. When you do so a list of possible conversion targets should appear on the right. Choose, for example, Microsoft Word Document (.docx). When you've done this a Choose File button should appear on the upper left. Click the button and navigate to your file. Click the Convert button and open the resulting document in Microsoft Word.

By selecting Show Advanced options you can access a drop-down list of the different profiles supported for the current conversion path.

3.3. Command-line scripts

When the stylesheet package is installed, either by running make install from source, or installing a Debian package, there are Linux/OSX command-line shell scripts available (docbooktotei, docxtotei, odttotei, tcptotei, teitobibtex, teitodocbook, teitodocx, teitodtd, teitoepub, teitoepub3, teitofo, teitohtml, teitohtml5, teitojson, teitolatex, teitoodd, teitoodt, teitopdf, teitordf, teitorelaxng, teitornc, teitoslides, teitotxt, teitoxsd, and xlsxtotei) for converting to/from Word, to/from OpenOffice, and to DTD, ePub, HTML, RDF, Relax NG, plain text, W3C schema etc. These are implemented using Ant tasks, so a local installation of Java 1.6+ and Ant is required.

The simplest use of the scripts is (eg)

teitohtml inputfile outputfile

but there are also a set of options, which you see by giving the command name followed by --help:

$ teitohtml --help

TEI conversion: from tei to html

  Usage: /usr/bin/teitohtml [options] inputfile [outputfile]

  Options, binary switches:
  --verbose            # be verbose
  --debug              # be verbose, do not delete intermediate files
  --apphome=/usr/share/xml/tei/stylesheet   # where to find app directory
  --profiledir=/usr/share/xml/tei/stylesheet/profiles    # where to find profile directory
  --profile=default    # which transformation profile to use
  --oxygenlib=/usr/share/oxygen/lib    # where is oxygenlib
  --odd                # perform processing of ODD (if appropriate)
  --localsource=DIR    # where is local copy of source of TEI Guidelines
  --summaryDoc         # only make summary, when doing ODD processing

  Options, shown with defaults:
  --saxonjar=/usr/share/saxon/saxon9he.jar  # location of Saxon jar file

3.4. Importing the XSL into your own stylesheet

If, for example, you want to write a customization of the HTML conversion you can simply refer to the specification html/html.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="html/html.xsl"/> </xsl:stylesheet> 

You can customize the result by adding to this wrapper file. The normal result will be a single stream of HTML which you can save in a file. You can also configure it to produce multiple output files, one per top-level <div> or <div1>.

4. File structure and customization

The stylesheets files consist of a number of scripts, and seven main directories where most of the work is done:

common
templates which are independent of output type, used by the other transformations
html
templates for making HTML output (also used for ePub)
latex
templates for making LaTeX output
docx
conversion to and from Word OOXML format
odt
conversion to and from OpenOffice ODF format
fo
templates for making XSL FO output
odds
processing of TEI ODD files

Within each directory there is usually a separate file for the templates which implement each of the TEI modules (eg html_textstructure.xsl, html_linking.xsl, or html_drama.xsl); these are included by a master file eg html.xsl. This also includes a parameterization layer in the file eg html_param.xsl, and the parameterization file from the common directory. The file (eg) html.xsl does any necessary declaration of constants and XSL keys.

There are further directories for other conversions, some which are built on top of the html one above:

bibtex
conversion to BibTeX
docbook
conversion to/from Docbook
dtd
ODD conversion to DTD
epub
conversion to ePub
epub3
conversion to ePub3
html5
conversion to HTML5
json
conversion to JSON
nlm
conversion to NLM
rdf
conversion to RDF (CIDOC CRM)
slides
conversion to LaTeX and HTML slides
tbx
conversion to TBX
tcp
conversion from Text Creation Partnership P4 XML
tite
conversion from TEI Tite to normal TEI P5
txt
conversion to plain text
xlsx
conversion from Microsoft Office spreadsheet format

5. Parameters and customizable templates

The TEI stylesheets are designed to be customized. There are several hundred things you can set to change the output in various formats. They are either XSL variables, named templates which you can override, or empty ‘hook’ templates into which you can add your own code. You need to understand a little of XSL syntax to work with these. 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.

You can also change any of the parameters from within the oXygen editor. Do this by going to the stylesheet configuration. Untick (eg) TEI P5 XHTML, but keep it highlighted and select ‘Duplicate’. You should see something like this:

Select ‘Parameters’, and you should see this:

Now you can scroll down to find a parameter to change, press ‘Edit’ and you'll see a dialogue like this:

Change the value, press OK to exit each dialogue, and then ‘Apply Associated’ to see the result.

You might apply, for example, some changes to the HTML rendering, by setting parameters as followws, and checking the results:

There are 13 areas for customization. In most cases there are parameters and templates which are specific to one of the three main output methods (HTML, FO and LaTeX), and those which are common to all three.

5.2. Layout

There are a few ways to provide a constant navigation aid, with a table of links on the left or right.

Hypertext links present special problems, as we have to choose whether they should start a new window, occupy all of the current window, or stay within the frame. These stylesheets implement the following rules:

  1. Any <ref> or <ptr> link stays within the frame
  2. Any link containing ‘://’ uses the whole browser window
  3. Any link starting ‘.’ uses the whole browser window
  4. If the stylesheet sets no splitting of the document, any <ref> or <ptr> link uses the whole browser window
  5. If a <ref> or <ptr> link has a rend attribute value of ‘noframe’, the whole browser window is used
  6. If a <ref> or <ptr> link has a rend attribute value of ‘new’, a new browser window is started

5.2.1. Variables

TypeNameDescriptionDefault
consecutiveFNsNumber footnotes consecutively [boolean]false
autoEndNotesMake all notes into endnotes [boolean]false
oddWeaveLiteWhether to make simplified display of ODD [boolean]false
parIndentParagraph indentation [string]1em
biblioStyleStyle for formatted bibliography [string]
parSkipDefault spacing between paragraphs [string]0pt
htmlfilePerPageWhether we should construct a separate file for each page (based on page breaks) [boolean]false
htmlviewPortWidthWhen making fixed format epub, width of viewport [number]1200
htmlviewPortHeightWhen making fixed format epub, height of viewport [number]1700
htmlfootnoteBackLinkLink back from footnotes to reference [boolean]false
htmlcontentStructureHow to use the front/body/back matter in creating columns. The choice is between all: use <front> for left-hand column, use <body> for centre column, and use <back> for right-hand columnbody: use <body> for right-hand column, generate left-hand with a TOC or whatever [string]body
htmldivOffsetThe difference between TEI div levels and HTML. headings. TEI <div>s are implicitly or explicitly numbered from 0 upwards; this offset is added to that number to produce an HTML <Hn> element. So a value of 2 here means that a <div1> will generate an <h2> [integer]2
htmlfootnoteFileMake a separate file for footnotes [boolean]false
htmllinksWidthWidth of left-hand column when $pageLayout is "Table" [string]15%
htmlnavbarFileXML resource defining a navigation bar. The XML should provide a <list> containing a series of <item> elements, each containing an <xref> link. [anyURI]
fobackMulticolumnsPut back matter in multiple columns [boolean]false
fobodyMarginBottomMargin at bottom of text body [string]24pt
fobodyMarginTopMargin at top of text body [string]24pt
fobodyMulticolumnsPut body matter in multiple columns [boolean]false
fobulletFourSymbol for 4th level itemized list [string]+
fobulletOneSymbol for top-level itemized list [string]
fobulletThreeSymbol for 3rd level itemized list [string]*
fobulletTwoSymbol for 2nd level itemized list [string]
focolumnCountNumber of columns, when multiple-column work is requested [integer]1
fobetweenStartsXSL FO "provisional-distance-between starts" [string]18pt
fobetweenGlossStartsXSL FO "provisional-distance-between starts" for gloss lists [string]42pt
fobetweenBiblStartsXSL FO "provisional-distance-between starts" for bibliographies [string]14pt
fodivRunningheadsDisplay section headings in running heads [boolean]false
foexampleAfterSpace below examples [string]4pt
foexampleBeforeSpace above examples [string]4pt
foexampleMarginLeft margin for examples [string]12pt
foflowMarginLeftLeft margin of flow [string]
foforcePageMasterWhich named page master name to use [string]
foformatBackpageHow to format page numbers in back matter (use XSLT number format) [string]1
foformatBodypageHow to format page numbers in main matter (use XSLT number format) [string]1
foformatFrontpageHow to format page numbers in front matter (use XSLT number format) [string]i
fofrontMulticolumnsPut front matter in multiple columns [boolean]false
folabelSeparationXSL FO "provisional-label-separation" [string]6pt
folistAbove-1Space above lists at top level [string]6pt
folistAbove-2Space above lists at 2nd level [string]4pt
folistAbove-3Space above lists at 3rd level [string]0pt
folistAbove-4Space above lists at 4th level [string]0pt
folistBelow-1Space below lists at top level [string]6pt
folistBelow-2Space below lists at 2nd level [string]4pt
folistBelow-3Space below lists at 3rd level [string]0pt
folistBelow-4Space below lists at 4th level [string]0pt
folistItemsepSpacing between list items [string]4pt
folistLeftGlossIndentLeft margin for gloss lists [string]0.5in
folistLeftGlossInnerIndentLeft margin for nested gloss lists [string]0.25in
folistLeftIndentIndentation for lists [string]0pt
folistRightMarginRight margin for lists [string]10pt
fopageHeightPaper height [string]297mm
fopageMarginBottomMargin at bottom of text area [string]100pt
fopageMarginLeftLeft margin [string]80pt
fopageMarginRightRight margin [string]150pt
fopageMarginTopMargin at top of text area [string]75pt
fopageWidthPaper width [string]211mm
foparSkipmaxMaximum space allowed between paragraphs [string]12pt
foreadColSpecFileExternal XML file containing specifications for column sizes for tables in document [anyURI]
foregionAfterExtentRegion after [string]14pt
foregionBeforeExtentRegion before [string]14pt
fosectionHeadersConstruct running headers from page number and section headings [boolean]true
fospaceAfterBiblSpace after bibliography [string]0pt
fospaceAroundTableSpace above and below a table [string]8pt
fospaceBeforeBiblSpace above bibliography [string]4pt
fospaceBelowCaptionSpace below caption of figure or table [string]4pt
fotitlePageMake title page [boolean]true
fotwoSidedMake 2-page spreads [boolean]true
latexclassParametersOptional parameters for documentclass [string]11pt,twoside
latexlatexLogoLogo graphics file [string]
latexpagebreakStyleWhen processing a "pb" element, decide what to generate: "active" generates a page break; "visible" generates a bracketed number (with scissors), and "bracketsonly" generates a bracketed number (without scissors). [float]
latextableMaxWidthWhen making a table, what width must be constrained to fit, as a proportion of the page width. [float]0.85
latexverseNumberingWhether to number lines of poetry [boolean]false
latexeveryHowManyLinesWhen numbering poetry, how often to put in a line number [integer]5
latexresetVerseLineNumberingWhen numbering poetry, when to restart the sequence; this must be the name of a TEI element [string]div1
latexlatexPaperSizeLaTeX paper size []a4paper

5.2.2. Templates

columnHeader
[html] Banner for top of column
hdr
[html] Header section across top of page
<xsl:call-template name="pageHeader"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">  <xsl:with-param name="mode"/> </xsl:call-template>
hdr2
[html] Navigation bar
<xsl:call-template name="navbar"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
preBreadCrumbPath
[html] Text or action to take at the start of the breadcrumb trail
hdr3
[html] Breadcrumb trail
<xhtml:a href="#rh-coltitle="Go to main page contentclass="skiplinks"    xmlns:html="http://www.w3.org/1999/xhtml">Skip links</xhtml:a> <xhtml:a class="hide">|</xhtml:a> <xsl:call-template name="crumbPath"/> <xhtml:a class="hide">|</xhtml:a> <xsl:if test="not($parentURL='')">  <xhtml:a class="bannerrighthref="{$parentURL}title="Go to home page">   <xsl:value-of select="$parentWords"/>  </xhtml:a> </xsl:if>
lh-col-bottom
[html]Bottom of left-hand column ID of selected section
<xsl:param name="currentID"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:call-template name="leftHandFrame">  <xsl:with-param name="currentIDselect="$currentID"/> </xsl:call-template>
lh-col-top
[html]Top of left-hand column
<xsl:call-template name="searchbox"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:call-template name="printLink"/>
logoPicture
[html] Logo
<xhtml:a   class="framelogo"   href="http://www.tei-c.org/Stylesheets/"    xmlns:html="http://www.w3.org/1999/xhtml">  <xhtml:img    src="http://www.tei-c.org/release/common/doc/tei-xsl-common/teixsl.png"    vspace="5"    width="124"    height="161"    border="0"    alt="created by TEI XSL Stylesheets"/> </xhtml:a>
metaHTML
[html] Making elements in HTML <head>The text used to create the DC.Title field in the HTML header
<xsl:param name="title"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xhtml:meta name="author">  <xsl:attribute name="content">   <xsl:sequence select="tei:generateAuthor(.)"/>  </xsl:attribute> </xhtml:meta> <xsl:if test="$filePerPage='true'">  <xhtml:meta    name="viewport"    content="width={$viewPortWidth}, height={$viewPortHeight}"/> </xsl:if> <xhtml:meta   name="generator"   content="Text Encoding Initiative Consortium XSLT stylesheets"/> <xsl:choose>  <xsl:when    test="$outputTarget='html5' or $outputTarget='epub3'">   <xhtml:meta charset="utf-8"/>  </xsl:when>  <xsl:otherwise>   <xhtml:meta     http-equiv="Content-Type"     content="text/html; charset={$outputEncoding}"/>   <xhtml:meta name="DC.Title">    <xsl:attribute name="content">     <xsl:value-of       select="normalize-space(translate($title,'<>','〈〉'))"/>    </xsl:attribute>   </xhtml:meta>   <xhtml:meta name="DC.Typecontent="Text"/>   <xhtml:meta name="DC.Formatcontent="text/html"/>  </xsl:otherwise> </xsl:choose>
navbar
[html] Construction of navigation bar A file is looked for relative to the stylesheet (the second parameter of the document function), which is expected to contain a TEI <list> where each <item> has an embedded <xref>
<xsl:choose    xmlns:html="http://www.w3.org/1999/xhtml"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">  <xsl:when test="$navbarFile=''">   <xsl:comment>no nav bar</xsl:comment>  </xsl:when>  <xsl:otherwise>   <xsl:element     name="{if ($outputTarget='html5') then 'nav' else 'div'}">    <xsl:for-each select="document($navbarFile,document(''))">     <xsl:for-each select="tei:list/tei:item">      <xhtml:span class="navbar">       <xhtml:a href="{$URLPREFIX}{tei:xref/@url}class="navbar">        <xsl:apply-templates select="tei:xref/text()"/>       </xhtml:a>      </xhtml:span>      <xsl:if test="following-sibling::tei:item"> | </xsl:if>     </xsl:for-each>    </xsl:for-each>   </xsl:element>  </xsl:otherwise> </xsl:choose>
pageHeader
[html] Banner for top of pagelayout mode
<xsl:param name="mode"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:choose>  <xsl:when test="$mode='table'">   <xhtml:table width="100%border="0">    <xhtml:tr>     <xhtml:td       height="98"       class="bgimage"       onclick="window.location='{$homeURL}'"       cellpadding="0">      <xsl:call-template name="makeHTMLHeading">       <xsl:with-param name="class">subtitle</xsl:with-param>       <xsl:with-param name="text">        <xsl:sequence select="tei:generateSubTitle(.)"/>       </xsl:with-param>       <xsl:with-param name="level">2</xsl:with-param>      </xsl:call-template>      <xsl:call-template name="makeHTMLHeading">       <xsl:with-param name="class">title</xsl:with-param>       <xsl:with-param name="text">        <xsl:sequence select="tei:generateTitle(.)"/>       </xsl:with-param>       <xsl:with-param name="level">1</xsl:with-param>      </xsl:call-template>     </xhtml:td>     <xhtml:td style="vertical-align:top;"/>    </xhtml:tr>   </xhtml:table>  </xsl:when>  <xsl:otherwise>   <xsl:call-template name="makeHTMLHeading">    <xsl:with-param name="class">subtitle</xsl:with-param>    <xsl:with-param name="text">     <xsl:sequence select="tei:generateSubTitle(.)"/>    </xsl:with-param>    <xsl:with-param name="level">2</xsl:with-param>   </xsl:call-template>   <xsl:call-template name="makeHTMLHeading">    <xsl:with-param name="class">title</xsl:with-param>    <xsl:with-param name="text">     <xsl:sequence select="tei:generateTitle(.)"/>    </xsl:with-param>    <xsl:with-param name="level">1</xsl:with-param>   </xsl:call-template>  </xsl:otherwise> </xsl:choose>
rh-col-bottom
[html] Bottom of right-hand columnID of selected section
<xsl:param name="currentID"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:call-template name="mainFrame">  <xsl:with-param name="currentIDselect="$currentID"/> </xsl:call-template>
rh-col-top
[html] Top of right-hand column
<xsl:call-template name="columnHeader"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
searchbox
[html] Make a search box
singleFileLabel
[html] Construct a label for the link which makes a printable version of the document.For Printing
latexPackages
LaTeX package setup Declaration of the LaTeX packages needed to implement this markup
<xsl:text    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\usepackage[</xsl:text> <xsl:value-of select="$latexPaperSize"/> <xsl:text>,</xsl:text> <xsl:value-of select="$latexGeometryOptions"/> <xsl:text>]{geometry} \usepackage{framed} </xsl:text> <xsl:text>\definecolor{shadecolor}{gray}{0.95} \usepackage{longtable} \usepackage[normalem]{ulem} \usepackage{fancyvrb} \usepackage{fancyhdr} \usepackage{marginnote} \renewcommand*{\marginfont}{\itshape\footnotesize} \setlength\marginparwidth{.75in} \usepackage{graphicx} </xsl:text> <xsl:if test="key('TREES',1)"> \usepackage{pstricks,pst-node,pst-tree} </xsl:if> <xsl:if test="key('ENDNOTES',1)"> \usepackage{endnotes} <xsl:choose>   <xsl:when test="key('FOOTNOTES',1)"> \def\theendnote{\@alph\c@endnote}   </xsl:when>   <xsl:otherwise> \def\theendnote{\@arabic\c@endnote}   </xsl:otherwise>  </xsl:choose> </xsl:if> <xsl:text>\def\Gin@extensions{.pdf,.png,.jpg,.mps,.tif} </xsl:text> <xsl:if test="not($userpackage='')"> \usepackage{<xsl:value-of select="$userpackage"/>} </xsl:if> <xsl:text> \pagestyle{fancy} </xsl:text> \usepackage[pdftitle={<xsl:sequence select="tei:generateSimpleTitle(.)"/>}, pdfauthor={<xsl:sequence   select="replace(string-join(tei:generateAuthor(.),''),'\\newline','')"/>}]{hyperref} \hyperbaseurl{<xsl:value-of select="$baseURL"/>} <xsl:if test="count(key('APP',1))>0">\usepackage{eledmac} <xsl:call-template name="ledmacOptions"/> </xsl:if>
latexSetup
LaTeX setup The basic LaTeX setup which you should not really tinker with unless you really understand why and how. Note that we need to set up a mapping here for Unicode 8421, 10100 and 10100 to glyphs for backslash and the two curly brackets, to provide literal characters. The normal characters remain active for LaTeX commands.
<xsl:call-template name="latexSetupHook"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> \IfFileExists{xcolor.sty}% {\RequirePackage{xcolor}}% {\RequirePackage{color}} \usepackage{colortbl} \usepackage{ifxetex} \ifxetex \usepackage{fontspec} \usepackage{xunicode} \catcode`⃥=\active \def⃥{\textbackslash} \catcode`❴=\active \def❴{\{} \catcode`❵=\active \def❵{\}} \def\textJapanese{\fontspec{Kochi Mincho}} \def\textChinese{\fontspec{HAN NOM A}\XeTeXlinebreaklocale "zh"\XeTeXlinebreakskip = 0pt plus 1pt } \def\textKorean{\fontspec{Baekmuk Gulim} } \setmonofont{<xsl:value-of select="$typewriterFont"/>} <xsl:if test="not($sansFont='')"> \setsansfont{<xsl:value-of select="$sansFont"/>} </xsl:if> <xsl:if test="not($romanFont='')"> \setromanfont{<xsl:value-of select="$romanFont"/>} </xsl:if> \else \IfFileExists{utf8x.def}% {\usepackage[utf8x]{inputenc} \PrerenderUnicode{–} }% {\usepackage[utf8]{inputenc}} <xsl:call-template name="latexBabel"/> \usepackage[T1]{fontenc} \usepackage{float} \usepackage[]{ucs} \uc@dclc{8421}{default}{\textbackslash } \uc@dclc{10100}{default}{\{} \uc@dclc{10101}{default}{\}} \uc@dclc{8491}{default}{\AA{}} \uc@dclc{8239}{default}{\,} \uc@dclc{20154}{default}{ } \uc@dclc{10148}{default}{>} \def\textschwa{\rotatebox{-90}{e}} \def\textJapanese{} \def\textChinese{} \IfFileExists{tipa.sty}{\usepackage{tipa}}{} \usepackage{times} \fi \def\exampleFont{\ttfamily\small} \DeclareTextSymbol{\textpi}{OML}{25} \usepackage{relsize} \RequirePackage{array} \def\@testpach{\@chclass \ifnum \@lastchclass=6 \@ne \@chnum \@ne \else \ifnum \@lastchclass=7 5 \else \ifnum \@lastchclass=8 \tw@ \else \ifnum \@lastchclass=9 \thr@@ \else \z@ \ifnum \@lastchclass = 10 \else \edef\@nextchar{\expandafter\string\@nextchar}% \@chnum \if \@nextchar c\z@ \else \if \@nextchar l\@ne \else \if \@nextchar r\tw@ \else \z@ \@chclass \if\@nextchar |\@ne \else \if \@nextchar !6 \else \if \@nextchar @7 \else \if \@nextchar (8 \else \if \@nextchar )9 \else 10 \@chnum \if \@nextchar m\thr@@\else \if \@nextchar p4 \else \if \@nextchar b5 \else \z@ \@chclass \z@ \@preamerr \z@ \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi} \gdef\arraybackslash{\let\\=\@arraycr} \def\@textsubscript#1{{\m@th\ensuremath{_{\mbox{\fontsize\sf@size\z@#1}}}}} \def\Panel#1#2#3#4{\multicolumn{#3}{){\columncolor{#2}}#4}{#1}} \def\abbr{} \def\corr{} \def\expan{} \def\gap{} \def\orig{} \def\reg{} \def\ref{} \def\sic{} \def\textcal#1{{\fontspec{<xsl:value-of select="$calligraphicFont"/>}#1}} \def\textgothic#1{{\fontspec{<xsl:value-of select="$gothicFont"/>}#1}} \def\textlarge#1{{\large #1}} \def\textoverbar#1{\ensuremath{\overline{#1}}} \def\textquoted#1{‘#1’} \def\textsmall#1{{\small #1}} \def\textsubscript#1{\@textsubscript{\selectfont#1}} \def\textxi{\ensuremath{\xi}} \def\titlem{\itshape} \newenvironment{biblfree}{}{\ifvmode\par\fi } \newenvironment{bibl}{}{} \newenvironment{byline}{\vskip6pt\itshape\fontsize{16pt}{18pt}\selectfont}{\par } \newenvironment{citbibl}{}{\ifvmode\par\fi } \newenvironment{docAuthor}{\ifvmode\vskip4pt\fontsize{16pt}{18pt}\selectfont\fi\itshape}{\ifvmode\par\fi } \newenvironment{docDate}{}{\ifvmode\par\fi } \newenvironment{docImprint}{\vskip 6pt}{\ifvmode\par\fi } \newenvironment{docTitle}{\vskip6pt\bfseries\fontsize{18pt}{22pt}\selectfont}{\par } \newenvironment{msHead}{\vskip 6pt}{\par} \newenvironment{msItem}{\vskip 6pt}{\par} \newenvironment{rubric}{}{} \newenvironment{titlePart}{}{\par } <xsl:text disable-output-escaping="yes">\newcolumntype{L}[1]{){\raggedright\arraybackslash}p{#1}} \newcolumntype{C}[1]{){\centering\arraybackslash}p{#1}} \newcolumntype{R}[1]{){\raggedleft\arraybackslash}p{#1}} \newcolumntype{P}[1]{){\arraybackslash}p{#1}} \newcolumntype{B}[1]{){\arraybackslash}b{#1}} \newcolumntype{M}[1]{){\arraybackslash}m{#1}} \definecolor{label}{gray}{0.75} \def\unusedattribute#1{\sout{\textcolor{label}{#1}}} \DeclareRobustCommand*{\xref}{\hyper@normalise\xref@} \def\xref@#1#2{\hyper@linkurl{#2}{#1}} \begingroup \catcode`\_=\active \gdef_#1{\ensuremath{\sb{\mathrm{#1}}}} \endgroup \mathcode`\_=\string"8000 \catcode`\_=12\relax </xsl:text>
latexBabel
LaTeX loading of babel with options
<xsl:text    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\usepackage[english]{babel}</xsl:text>
latexLayout
LaTeX layout preamble All the LaTeX setup which affects page layout
<xsl:choose    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">  <xsl:when test="$latexPaperSize='a3paper'">\paperwidth297mm    \paperheight420mm  </xsl:when>  <xsl:when test="$latexPaperSize='a5paper'">    \paperwidth148mm    \paperheight210mm  </xsl:when>  <xsl:when test="$latexPaperSize='a4paper'">\paperwidth210mm    \paperheight297mm  </xsl:when>  <xsl:when test="$latexPaperSize='letterpaper'">\paperwidth216mm    \paperheight279mm  </xsl:when>  <xsl:otherwise/> </xsl:choose> \def\@pnumwidth{1.55em} \def\@tocrmarg {2.55em} \def\@dotsep{4.5} \setcounter{tocdepth}{3} \clubpenalty=8000 \emergencystretch 3em \hbadness=4000 \hyphenpenalty=400 \pretolerance=750 \tolerance=2000 \vbadness=4000 \widowpenalty=10000 <xsl:if test="not($documentclass='letter')">\renewcommand\section{\@startsection {section}{1}{\z@}% {-1.75ex \@plus -0.5ex \@minus -.2ex}% {0.5ex \@plus .2ex}% {\reset@font\Large\bfseries\sffamily}} \renewcommand\subsection{\@startsection{subsection}{2}{\z@}% {-1.75ex\@plus -0.5ex \@minus- .2ex}% {0.5ex \@plus .2ex}% {\reset@font\Large\sffamily}} \renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}% {-1.5ex\@plus -0.35ex \@minus -.2ex}% {0.5ex \@plus .2ex}% {\reset@font\large\sffamily}} \renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}% {-1ex \@plus-0.35ex \@minus -0.2ex}% {0.5ex \@plus .2ex}% {\reset@font\normalsize\sffamily}} \renewcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}% {1.5ex \@plus1ex \@minus .2ex}% {-1em}% {\reset@font\normalsize\bfseries}} </xsl:if> \def\l@section#1#2{\addpenalty{\@secpenalty} \addvspace{1.0em plus 1pt} \@tempdima 1.5em \begingroup \parindent \z@ \rightskip \@pnumwidth \parfillskip -\@pnumwidth \bfseries \leavevmode #1\hfil \hbox to\@pnumwidth{\hss #2}\par \endgroup} \def\l@subsection{\@dottedtocline{2}{1.5em}{2.3em}} \def\l@subsubsection{\@dottedtocline{3}{3.8em}{3.2em}} \def\l@paragraph{\@dottedtocline{4}{7.0em}{4.1em}} \def\l@subparagraph{\@dottedtocline{5}{10em}{5em}} \@ifundefined{c@section}{\newcounter{section}}{} \@ifundefined{c@chapter}{\newcounter{chapter}}{} \newif\if@mainmatter \@mainmattertrue \def\chaptername{Chapter} \def\frontmatter{% \pagenumbering{roman} \def\thechapter{\@roman\c@chapter} \def\theHchapter{\roman{chapter}} \def\@chapapp{}% } \def\mainmatter{% \cleardoublepage \def\thechapter{\@arabic\c@chapter} \setcounter{chapter}{0} \setcounter{section}{0} \pagenumbering{arabic} \setcounter{secnumdepth}{6} \def\@chapapp{\chaptername}% \def\theHchapter{\arabic{chapter}} } \def\backmatter{% \cleardoublepage \setcounter{chapter}{0} \setcounter{section}{0} \setcounter{secnumdepth}{2} \def\@chapapp{\appendixname}% \def\thechapter{\@Alph\c@chapter} \def\theHchapter{\Alph{chapter}} \appendix } \newenvironment{bibitemlist}[1]{% \list{\@biblabel{\@arabic\c@enumiv}}% {\settowidth\labelwidth{\@biblabel{#1}}% \leftmargin\labelwidth \advance\leftmargin\labelsep \@openbib@code \usecounter{enumiv}% \let\p@enumiv\@empty \renewcommand\theenumiv{\@arabic\c@enumiv}% }% \sloppy \clubpenalty4000 \@clubpenalty \clubpenalty \widowpenalty4000% \sfcode`\.\@m}% {\def\@noitemerr {\@latex@warning{Empty `bibitemlist' environment}}% \endlist} \def\tableofcontents{\section*{\contentsname}\@starttoc{toc}} \parskip<xsl:value-of select="$parSkip"/> \parindent<xsl:value-of select="$parIndent"/> \def\Panel#1#2#3#4{\multicolumn{#3}{){\columncolor{#2}}#4}{#1}} \newenvironment{reflist}{% \begin{raggedright}\begin{list}{} {% \setlength{\topsep}{0pt}% \setlength{\rightmargin}{0.25in}% \setlength{\itemsep}{0pt}% \setlength{\itemindent}{0pt}% \setlength{\parskip}{0pt}% \setlength{\parsep}{2pt}% \def\makelabel##1{\itshape ##1}}% } {\end{list}\end{raggedright}} \newenvironment{sansreflist}{% \begin{raggedright}\begin{list}{} {% \setlength{\topsep}{0pt}% \setlength{\rightmargin}{0.25in}% \setlength{\itemindent}{0pt}% \setlength{\parskip}{0pt}% \setlength{\itemsep}{0pt}% \setlength{\parsep}{2pt}% \def\makelabel##1{\upshape\sffamily ##1}}% } {\end{list}\end{raggedright}} \newenvironment{specHead}[2]% {\vspace{20pt}\hrule\vspace{10pt}% \hypertarget{#1}{}% \markright{#2}% <xsl:text> \pdfbookmark[</xsl:text> <xsl:value-of select="$specLinkDepth"/> <xsl:text>]{#2}{#1}% \hspace{-0.75in}{\bfseries\fontsize{16pt}{18pt}\selectfont#2}% }{} </xsl:text> <xsl:call-template name="latexPreambleHook"/>
ledmacOptions
LaTeX setup commands for ledmac package
<xsl:text    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\renewcommand{\notenumfont}{\bfseries} \lineation{page} \linenummargin{inner} \footthreecol{A} \foottwocol{B} </xsl:text>
latexBegin
LaTeX setup before start of document All the LaTeX setup which are executed before the start of the document
<xsl:text    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\makeatletter \thispagestyle{empty} \markright{\@title}\markboth{\@title}{\@author} \renewcommand\small{\@setfontsize\small{9pt}{11pt}\abovedisplayskip 8.5\p@ plus3\p@ minus4\p@ \belowdisplayskip \abovedisplayskip \abovedisplayshortskip \z@ plus2\p@ \belowdisplayshortskip 4\p@ plus2\p@ minus2\p@ \def\@listi{\leftmargin\leftmargini \topsep 2\p@ plus1\p@ minus1\p@ \parsep 2\p@ plus\p@ minus\p@ \itemsep 1pt} } \makeatother \fvset{frame=single,numberblanklines=false,xleftmargin=5mm,xrightmargin=5mm} \fancyhf{} \setlength{\headheight}{14pt} \fancyhead[LE]{\bfseries\leftmark} \fancyhead[RO]{\bfseries\rightmark} \fancyfoot[RO]{} \fancyfoot[CO]{\thepage} \fancyfoot[LO]{\TheID} \fancyfoot[LE]{} \fancyfoot[CE]{\thepage} \fancyfoot[RE]{\TheID} \hypersetup{linkbordercolor=0.75 0.75 0.75,urlbordercolor=0.75 0.75 0.75,bookmarksnumbered=true} \fancypagestyle{plain}{\fancyhead{}\renewcommand{\headrulewidth}{0pt}}</xsl:text>
latexEnd
LaTeX setup at end of document All the LaTeX setup which are executed at the end of the document

5.3. Headings

Headings for sections can be customized in various ways.

5.3.1. Variables

TypeNameDescriptionDefault
autoHeadWhether to construct a heading for <div> elements with no <head> - by default, not. [boolean]false
numberSpacerCharacter to put after number of section header [string]
<xsl:text    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>

5.3.2. Templates

autoMakeHead
[common] How to make a heading for section if there is no <head>
<xsl:param name="display"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:choose>  <xsl:when test="@n">   <xsl:value-of select="@n"/>  </xsl:when>  <xsl:when test="tei:docDate">   <xsl:apply-templates select="tei:docDatemode="plain"/>  </xsl:when>  <xsl:otherwise>   <xsl:text>§</xsl:text>  </xsl:otherwise> </xsl:choose>
headingNumberSuffix
Punctuation to insert after a section number
<xsl:text    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">.</xsl:text> <xsl:value-of select="$numberSpacer"/>

5.4. Numbering

Section headings, figures, tables and notes can be numbered automatically. We can set the numbering of front matter and back matter separately. If you prefer to supply your own numbering, using the n attribute, you can choose this over automatic numbering.

Normally, heading numbers are followed by ‘. ’, but you can vary this. This would let you use eg fixed spaces.

5.4.1. Variables

TypeNameDescriptionDefault
numberBackFiguresAutomatically number figures in back matter [boolean]false
numberBackHeadingsHow to construct heading numbering in back matter [string]A.1
numberBackTablesAutomatically number tables in back matter [boolean]true
numberFiguresAutomatically number figures [boolean]true
numberFrontFiguresAutomatically number figures in front matter [boolean]false
numberFrontHeadingsHow to construct heading numbering in front matter [string]
numberFrontTablesAutomatically number tables in front matter [boolean]true
numberHeadingsAutomatically number sections [boolean]true
numberHeadingsDepthDepth to which sections should be numbered [integer]9
numberTablesAutomatically number tables [boolean]true
prenumberedHeadingsUse value of "n" attribute to number sections [boolean]false
numberParagraphsAutomatically number paragraphs. [boolean]false

5.4.2. Templates

numberBackDiv
[common] How to number sections in back matter
<xsl:if test="not($numberBackHeadings='')"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">  <xsl:number    count="tei:div|tei:div1|tei:div2|tei:div3|tei:div4|tei:div5|tei:div6"    format="A.1.1.1.1.1"    level="multiple"/> </xsl:if>
numberBodyDiv
[common] How to number sections in main matter
<xsl:if test="$numberHeadings='true'"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">  <xsl:number    count="tei:div|tei:div1|tei:div2|tei:div3|tei:div4|tei:div5|tei:div6"    level="multiple"/> </xsl:if>
numberFrontDiv
[common] How to number sections in front matter
<xsl:param name="minimal"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:number   count="tei:div|tei:div1|tei:div2|tei:div3|tei:div4|tei:div5|tei:div6"   level="multiple"/> <xsl:if test="$minimal='false'">  <xsl:value-of select="$numberSpacer"/> </xsl:if>

5.5. Output

You can set a name for the output file(s); if you ask for multiple output files, this name will be used to create unique filenames for each section. By default, results will go to wherever your XSLT processor normally writes (usually standard output). If you opt to have files created, you can specify the name of the directory where the output is to be placed.

If you are making HTML, do you want a single output page, or a separate one for each section of the document? You can decide to have a different splitting policy for front and back matter.

5.5.1. Variables

TypeNameDescriptionDefault
outputTargetType of output being generated [string]html
REQUESTThe complete URL when the document is being delivered from a web server (normally set by Apache or Cocoon) [string]
STDOUTWrite to standard output channel [boolean]true
htmlIDAn ID passed to the stylesheet to indicate which section to display [string]
htmlrequestedIDA wrapper around the ID, to allow for other ways of getting it [string]
<xsl:value-of   select="$ID"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
htmlURLPREFIXA path fragment to put before all internal URLs [string]
htmloutputNameThe name of the output file [string]
htmloutputDirDirectory in which to place generated files. [string]
htmloutputEncodingEncoding of output file(s). [string]utf-8
htmloutputMethodOutput method for output file(s). [string]xhtml
htmloutputSuffixSuffix of output file(s). [string].html
htmldoctypePublicPublic Doctype of output file(s). [string]-//W3C//DTD XHTML 1.0 Transitional//EN
htmldoctypeSystemSystem Doctype of output file(s). [string]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
htmlpageLayoutThe style of HTML (Simple or Complex) which creates the layout for generated pages. The choice is between Simple: A linear presentation is createdComplex: The page is created as a series of nested <div>s which can be arranged using CSS into a multicolumn layoutTable: The page is created as an HTML table [string]Simple
htmlsplitBackmatterBreak back matter into separate HTML pages (if splitting enabled). [boolean]true
htmlsplitFrontmatterBreak front matter into separate HTML pages (if splitting enabled). [boolean]true
htmlsplitLevelLevel at which to split sections. When processing a <div> or <div[0-5]>, compare the nesting depth and see whether to start a new HTML page. Since the TEI starts with <div1>, setting this parameter to 0 will cause top-level sections to be split apart. The default is not to split at all. [integer]-1
htmlstandardSuffixSuffix for generated output files. [string]
<xsl:choose    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">  <xsl:when    test="tei:teiCorpus">.html</xsl:when>  <xsl:when    test="$STDOUT='true'"/>  <xsl:otherwise>   <xsl:value-of     select="$outputSuffix"/>  </xsl:otherwise> </xsl:choose>
htmltopNavigationPanelDisplay navigation panel at top of pages. [boolean]true
htmlurlChunkPrefixHow to specify infra-document links. When a document is split, links need to be constructed between parts of the document. The default is to use a query parameter on the URL. [string]?ID=
htmluseIDsConstruct links using existing ID values. It is often nice if, when making separate files, their names correspond to the ID attribute of the >div<. Alternatively, you can let the system choose names. [boolean]true
folanguageLanguage (for hyphenation) [string]en_US
fofoEngineName of intended XSL FO engine This is used to tailor the result for different XSL FO processors. By default, no special measures are taken, so there are no bookmarks or other such features. Possible values are passivetex (the TeX-based PassiveTeX processor) xep (XEP) fop (FOP) antenna (Antenna House) [string]
latexORIGDIRlocation of original XML file, for looking up relative pointers [string]
latexbaseURLURL root where referenced documents are located [string]
latexrealFiguresUse real name of graphics files rather than pointers [boolean]true

5.5.2. Templates

5.6. Table of contents generation

You probably want tables of contents built for your document, using the <div> structure. However, if you have used a divGen type="toc" explicitly, that will also create a table of contents, so you can suppress the automatic one. When a table of contents is created, you choose how many levels of headings it will show. You can choose whether or not the front and backmatter appear in the table of contents.

5.6.1. Variables

TypeNameDescriptionDefault
htmlautoTocMake an automatic table of contents [boolean]true
htmlclass_subtocCSS class for second-level TOC entries [string]subtoc
htmlsubTocDepthDepth at which to stop doing a recursive table of contents. You can have a mini table of contents at the start of each section. The default is only to construct a TOC at the top level; a value of -1 here means no subtoc at all. [integer]-1
htmltocBackInclude the back matter in the table of contents. [boolean]true
htmltocDepthDepth to which table of contents is constructed. [string]5
htmltocFrontInclude the front matter in the table of contents. [boolean]true
htmltocElementWhich HTML element to wrap each TOCs entry in. [string]p
htmltocContainerElementWhich HTML element to wrap each TOC sections in. [string]div
htmlrefDocFooterTextText to link back to from foot of ODD reference pages [string]TEI Guidelines
htmlrefDocFooterURLURL to link back to from foot of ODD reference pages [anyURI]index.html
htmlgenerateDivFromPWhen a TEI <p> generates an HTML <p> (possibly split) or a <div class="p"> [boolean]false
fodiv0TocindentIndentation for level 0 TOC entries [string]0in
fodiv1TocindentIndentation for level 1 TOC entries [string]0.25in
fodiv2TocindentIndentation for level 2 TOC entries [string]0.5in
fodiv3TocindentIndentation for level 3 TOC entries [string]0.75in
fodiv4TocindentIndentation for level 4 TOC entries [string]1in
fodiv5TocindentIndentation for level 5 TOC entries [string]1.25in
fotocBackMake TOC for sections in <back> [boolean]true
fotocFrontMake TOC for sections in <front> [boolean]true
fotocNumberSuffixPunctuation to insert after a section number in a TOC [string].
fotocStartPagePage number on which TOC should start [integer]1

5.7. Internationalization

At various places, the system has to create text. You can choose the words it uses (eg translate them to another language).

5.7.1. Templates

copyrightStatement
[html] Make a copyright claim

5.8. CSS

Setting up material for the CSS file to accompany HTML output.

5.8.1. Variables

TypeNameDescriptionDefault
class_tocCSS class for TOC entries [string]toc
htmlclass_ptrCSS class for links derived from <ptr> [string]ptr
htmlclass_refCSS class for links derived from <ref> [string]ref
htmlcssFileCSS style file to be associated with output file(s) [anyURI]http://www.tei-c.org/release/xml/tei/stylesheet/tei.css
htmlcssPrintFileCSS style file for print; this will be given a media=print attribute. [anyURI]http://www.tei-c.org/release/xml/tei/stylesheet/tei-print.css
htmlcssSecondaryFileSecondary CSS style file; this will be given a media=screen attribute, so that it does not affect printing. It should be used for screen layout. [anyURI]
htmlcssInlineFileCSS file to include in the output file directly [anyURI]

5.9. Tables

Default behaviour of table elements.

5.9.1. Variables

TypeNameDescriptionDefault
cellAlignDefault alignment of table cells [string]left
tableAlignDefault alignment of tables [string]left
fodefaultCellLabelBackgroundDefault colour for background of table cells which are labelling rows or columns [string]silver
foinlineTablesForce tables to appear inline [boolean]false
fomakeTableCaptionPut a caption on tables [boolean]true
fotableCaptionAlignAlignment of table captions [string]center
fotableCellPaddingDefault padding on table cells [string]2pt

5.10. Figures and graphics

Sometimes you need to prefix the names of all graphics files with a directory name or a URL, or provide a default suffix. You can also tell <figure> elements whether or not to produce anything.

5.10.1. Variables

TypeNameDescriptionDefault
graphicsPrefixDirectory specification to put before names of graphics files, unless they start with "./" [string]
graphicsSuffixDefault file suffix for graphics files, if not directly specified [string].png
standardScaleScaling of imported graphics [decimal]1
headInXref[common] Whether cross-reference to a figure or table includes its caption [boolean]true
htmldpiResolution of images. This is needed to calculate HTML width and height (in pixels) from supplied dimensions. [integer]96
htmlshowFiguresDisplay figures. [boolean]true
foautoScaleFiguresHow to scale figures if no width and height specified (pass to XSL FO content-width) [string]
focaptionInlineFiguresPut captions on inline figures [boolean]false
foshowFloatHeadShow the contents of <head> in a cross-reference to table or figure [boolean]false
foshowFloatLabelShow a title for figures or tables (eg Table or Figure) in a cross-reference [boolean]false
foxrefShowPageShow the page number in a cross-reference to table or figure [boolean]false

5.10.2. Templates

figureCaptionstyle
[fo] Set attributes for display of figures
<xsl:attribute name="text-align"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">center</xsl:attribute> <xsl:attribute name="font-style">italic</xsl:attribute> <xsl:attribute name="end-indent">  <xsl:value-of select="$exampleMargin"/> </xsl:attribute> <xsl:attribute name="start-indent">  <xsl:value-of select="$exampleMargin"/> </xsl:attribute>

5.11. Style

You can choose lots of features which affect the font, size, etc

  • What font to use for URLs.
  • Whether titles, dates and authors are shown.
  • Whether headings of objects are included in cross-references.

5.11.1. Variables

TypeNameDescriptionDefault
pagebreakStyleDisplay of <pb> element. Choices are "visible", "active" and "none". [string]visible
displayModeHow to display Relax NG schema fragments (rnc or rng) [string]rnc
minimalCrossRefProvide minimal context for a link [boolean]false
postQuoteCharacter to insert at end of quote. [string]
preQuoteCharacter to insert at start of quote [string]
htmlurlMarkupHTML element to put around visible text of display URLs [string]span
foactiveLinebreaksMake <lb> active (ie cause a line break) [boolean]true
foalignmentAlignment of text (ie justified or ragged) [string]justify
fobiblSizeFont size for bibliography [string]16pt
fobodyFontDefault font for body [string]Times
fobodyMasterDefault font size for body (without dimension) [string]10
fobodySizeCalculation of normal body font size (add dimension) [string]
<xsl:value-of   select="$bodyMaster"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text>pt</xsl:text>
fodivFontFont for section headings [string]Times
foexampleColorColour for display of <eg> blocks. [string]black
foexampleBackgroundColorColour for background display of <eg> blocks. [string]gray
foexampleSizeCalculation of font size for examples (add dimension) [string]
<xsl:value-of   select="$bodyMaster * 0.6"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text>pt</xsl:text>
foquoteSizeCalculation of font size for quotations [string]
<xsl:value-of   select="$bodyMaster * 0.9"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text>pt</xsl:text>
fofootnoteSizeFont size for footnotes [string]
<xsl:value-of   select="$bodyMaster * 0.9"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
fofootnotenumSizeFont size for footnote numbers [string]
<xsl:value-of   select="$bodyMaster * 0.7"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
fogiColorColour for display of element names [string]black
foheadingOutdentIndentation of headings [string]0em
fohyphenateHyphenate text [boolean]true
foidentColorColour for display of <ident> values Customization parameter. [string]black
forunFontFont family for running header and footer [string]sans-serif
forunSizeFont size for running header and footer [string]9pt
fosansFontSans-serif font [string]Helvetica
fosmallSizeCalculation of small font size (add dimension) [string]
<xsl:value-of   select="$bodyMaster * 0.9"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text>pt</xsl:text>
fotableSizeCreate font size for tables, by reference to $bodyMaster [string]
<xsl:value-of   select="$bodyMaster * 0.9"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text>pt</xsl:text>
fotocSizeFont size for TOC heading [string]16pt
fotypewriterFontFont for literal code [string]Courier
latexexampleFontFont for examples [string]Courier New
latextypewriterFontFont for literal code [string]DejaVu Sans Mono
latexsansFontFont for sans-serif [string]
latexromanFontFont for serif [string]
latexgothicFontFont for gothic [string]Lucida Blackletter
latexcalligraphicFontFont for calligraphic [string]Lucida Calligraphy

5.11.2. Templates

divXRefHeading
[fo] How to display section headings in a cross-reference section title
<xsl:param name="head"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">  <xsl:apply-templates mode="sectionselect="tei:head"/> </xsl:param> <xsl:text> (</xsl:text> <xsl:value-of select="normalize-space($head)"/> <xsl:text>)</xsl:text>
linkStyle
[fo] Set attributes for display of links
<xsl:attribute name="text-decoration"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">underline</xsl:attribute>
setupDiv0
[fo] Set attributes for display of heading for chapters (level 0)
<xsl:attribute name="font-size"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">18pt</xsl:attribute> <xsl:attribute name="text-align">left</xsl:attribute> <xsl:attribute name="font-weight">bold</xsl:attribute> <xsl:attribute name="space-after">6pt</xsl:attribute> <xsl:attribute name="space-before.optimum">12pt</xsl:attribute> <xsl:attribute name="text-indent">  <xsl:value-of select="$headingOutdent"/> </xsl:attribute>
setupDiv1
[fo] Set attributes for display of heading for 1st level sections
<xsl:attribute name="font-size"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">14pt</xsl:attribute> <xsl:attribute name="text-align">left</xsl:attribute> <xsl:attribute name="font-weight">bold</xsl:attribute> <xsl:attribute name="space-after">3pt</xsl:attribute> <xsl:attribute name="space-before.optimum">9pt</xsl:attribute> <xsl:attribute name="text-indent">  <xsl:value-of select="$headingOutdent"/> </xsl:attribute>
setupDiv2
[fo] Set attributes for display of heading for 2nd level sections
<xsl:attribute name="font-size"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">12pt</xsl:attribute> <xsl:attribute name="text-align">left</xsl:attribute> <xsl:attribute name="font-weight">bold</xsl:attribute> <xsl:attribute name="font-style">italic</xsl:attribute> <xsl:attribute name="space-after">2pt</xsl:attribute> <xsl:attribute name="space-before.optimum">4pt</xsl:attribute> <xsl:attribute name="text-indent">  <xsl:value-of select="$headingOutdent"/> </xsl:attribute>
setupDiv3
[fo]Set attributes for display of heading for 3rd level sections
<xsl:attribute name="font-size"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">10pt</xsl:attribute> <xsl:attribute name="text-align">left</xsl:attribute> <xsl:attribute name="font-style">italic</xsl:attribute> <xsl:attribute name="space-after">0pt</xsl:attribute> <xsl:attribute name="space-before.optimum">4pt</xsl:attribute> <xsl:attribute name="text-indent">  <xsl:value-of select="$headingOutdent"/> </xsl:attribute>
setupDiv4
[fo] Set attributes for display of heading for 4th level sections
<xsl:attribute name="font-size"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">10pt</xsl:attribute> <xsl:attribute name="text-align">left</xsl:attribute> <xsl:attribute name="font-style">italic</xsl:attribute> <xsl:attribute name="space-after">0pt</xsl:attribute> <xsl:attribute name="space-before.optimum">4pt</xsl:attribute> <xsl:attribute name="text-indent">  <xsl:value-of select="$headingOutdent"/> </xsl:attribute>
setupDiv5
[fo] Set attributes for display of heading for 5th level sections
<xsl:attribute name="font-size"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">10pt</xsl:attribute> <xsl:attribute name="text-align">left</xsl:attribute> <xsl:attribute name="font-style">italic</xsl:attribute> <xsl:attribute name="space-after">0pt</xsl:attribute> <xsl:attribute name="space-before.optimum">4pt</xsl:attribute> <xsl:attribute name="text-indent">  <xsl:value-of select="$headingOutdent"/> </xsl:attribute>
setupDiv6
[fo] Set attributes for display of heading for 6th level sections
<xsl:attribute name="font-size"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">10pt</xsl:attribute> <xsl:attribute name="text-align">left</xsl:attribute> <xsl:attribute name="font-style">italic</xsl:attribute> <xsl:attribute name="space-after">0pt</xsl:attribute> <xsl:attribute name="space-before.optimum">4pt</xsl:attribute> <xsl:attribute name="text-indent">  <xsl:value-of select="$headingOutdent"/> </xsl:attribute>
showXrefURL
[fo] How to display the link text of a <ptr>the URL being linked to
<xsl:param name="dest"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:value-of select="$dest"/>

5.12. Hooks

A set of templates which are empty by default; they can be used to add code at strategic points. The content must be valid XSLT.

5.12.1. Templates

sectionHeadHook
[common] Hook where actions can be inserted when making a heading
attDefHook
[common] Hook where actions can be inserted when processing an attDef Used in Guidelines output to create an anchor/link pilcrow.
<xsl:param name="attName"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
bodyHook
[html] Hook where HTML can be inserted just after <body>
bodyEndHook
[html] Hook where HTML can be inserted just before the <body> ends. This can be used to add a page-wide footer block.
bodyJavascriptHook
[html] Hook where Javascript calls can be inserted just after <body>
cssHook
[html] Hook where extra CSS can be inserted  
headHook
[html] Hook where code can be added to the HTML <head>. This would be used to insert <meta> tags.
imgHook
[html] Hook where HTML can be inserted when creating an <img>
figureHook
[html] Hook where HTML can be inserted when processing a figure
javascriptHook
[html] Hook where extra Javascript functions can be defined
preAddressHook
[html] Hook where HTML can be inserted just before the <address>
startDivHook
[html] Hook where HTML can be inserted at the start of processing each section
startHook
[html] Hook where HTML can be inserted at the beginning of the main text, after the header
teiEndHook
[html] Hook where HTML can be inserted after processing <TEI>
teiStartHook
[html] Hook where HTML can be inserted before processing <TEI>
xrefHook
[html] Hook where HTML can be inserted when creating an <a> element
egXMLStartHook
[html] Hooks where HTML can be inserted when processing <egXML> element
afterBodyHook
[fo] Hook where extra material can be inserted after the <body> has been processed
blockStartHook
[fo] Hook where work can be done at the start of each block
pageMasterHook
[fo] Hook where extra page masters can be defined
beginDocumentHook
[latex] Hook where LaTeX commands can be inserted after the beginning of the document
latexSetupHook
[latex] Hook where LaTeX commands can be at start of setup
latexPreambleHook
[latex] Hook where LaTeX commands can be inserted in the preamble before the beginning of the document

5.13. Miscellaneous and advanced

Finally, some miscellaneous or advanced features which you probably won't use much.

5.13.1. Variables

TypeNameDescriptionDefault
teixslHomeThe home page for these stylesheets [anyURI]http://www.tei-c.org/Stylesheets/
teiP4CompatProcess elements according to assumptions of TEI P4 [boolean]false
htmlgenerateParagraphIDsGenerate a unique ID for all paragraphs [boolean]false
htmlshowTitleAuthorShow a title and author at start of document [boolean]false
htmlverboseBe talkative while working. [boolean]false

6. Notes on XSLT processors and XSL FO

These stylesheets use XSLT 2.0, and have only been tested with Saxon (from http://saxon.sourceforge.net). An older set of XSLT 1.0 stylesheets are also available, but is not maintained or updated.

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.

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.

Notes
1
Based on the Enrich Garage Engine developed by Poznan Supercomputing and Networking Center and Oxford University Computing Services for the ENRICH project.
Sebastian Rahtz. Date: 2013-07-20