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 textual formats formats, including XHTML, LaTeX, XSL Formatting Objects, ePub, plain text, RDF, and 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 project starting points. Each profile is a subdirectory of the profiles directory. Each profile represents a specific set of customizations of the basic stylesheet functions, each for a particular audience or purpose. For example, the ota profile is customized for working with texts from the Oxford Text Archive, and the dhoxss profile is for materials related to the Digital Humanities Oxford Summer School. Most users will want to work with the default profile.

The profile default is used if no other setup is selected, and is the fallback when a profile is requested but does not contain any customization directory for the chosen format.

The profiles 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. There may also be a from.xsl to go from the selected format to TEI XML.

3. Formats and file structure

The stylesheets code is divided into directories by input or output format, as described in the table below. In addition there are some general-purpose directories:

common
templates which are independent of output type, used by the other transformations
odds
processing of TEI ODD files
slides
creation of LaTeX code for ‘beamer’ slides
tools
assorted free-standing utilities

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.

name Description from TEI to TEI
bibtex LaTeX BibTeX x
cocoa Cocoa simple markup x
csv Comma-separated values (TEI tables only) x x
docbook Docbook 5.0 x x
docx Microsoft Word (OOXML) x x
dtd XML DTD (from ODD) x
epub3 ePub version 3 x
epub ePub x
fo XSL Formatting Objects x
html5 HTML5 x
html HTML (also used by ePub) x
json JSON (minimal) x
latex LaTeX x
markdown Markdown x x
nlm NLM x
odd TEI compiled ODD x
odt OpenOffice (ODF) x x
p4 TEI P4 x
pdf PDF (generated by running LaTeX) x
rdf RDF (CIDOC CRM) x
relaxng RELAX NG schema (from ODD) x
rnc RELAX NG schema (compact format) x
schematron Schematron schema (from ODD) x
tbx TBX x
tcp Text Creation Partnership P4 XML x
tite TEI Tite capture format x
txt Plain text x
verbatimxml Pretty-printed XML x
wordpress Wordpress x
xlsx Excel (OOXML) x
xsd W3C schema (from ODD) x

4. Using the stylesheets

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

4.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.

4.2. 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 https://sourceforge.net/projects/tei/files/tei-oxygen/. 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.0"  exclude-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.

4.3. 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, go 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.

4.4. 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 (cocoatotei, docbooktotei, docxtotei, htmltotei, markdowntotei, odttotei, p4totei, tcptotei, teitobibtex, teitocsv, teitodocbook, teitodocx, teitodtd, teitoepub, teitoepub3, teitofo, teitohtml, teitohtml5, teitojson, teitolatex, teitolite, teitomarkdown, teitonlm, teitoodd, teitoodt, teitopdf, teitordf, teitorelaxng, teitornc, teitoschematron, teitoslides, teitotxt, teitoverbatimxml, teitoxsd, wordpresstotei, 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/saxon10he.jar  # location of Saxon jar file

4.5. 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>.

5. Documentation of common conversions and start points

6. 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.

6.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

6.2.1. Variables

Type Name Description Default
consecutiveFNs Number footnotes consecutively [boolean] false
autoEndNotes Make all notes into endnotes [boolean] false
oddWeaveLite Whether to make simplified display of ODD [boolean] false
parIndent Paragraph indentation [string] 1em
biblioStyle Style for formatted bibliography [string]
DOIResolver The initial part of a the URI of a DOI resolution service [string]
parSkip Default spacing between paragraphs [string] 0pt
html separator Separator between items in header, footer etc [string]
<xsl:text    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> </xsl:text>
html treestyle which Javascript library to use for drawing trees [string] googlechart
html filePerPage Whether we should construct a separate file for each page (based on page breaks) [boolean] false
html viewPortWidth When making fixed format epub, width of viewport [number] 1200
html viewPortHeight When making fixed format epub, height of viewport [number] 1700
html footnoteBackLink Link back from footnotes to reference [boolean] false
html contentStructure How 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
html divOffset The 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
html footnoteFile Make a separate file for footnotes [boolean] false
html navbarFile XML resource defining a navigation bar. The XML should provide a <list> containing a series of <item> elements, each containing an <xref> link. [anyURI]
fo backMulticolumns Put back matter in multiple columns [boolean] false
fo bodyMarginBottom Margin at bottom of text body [string] 24pt
fo bodyMarginTop Margin at top of text body [string] 24pt
fo bodyMulticolumns Put body matter in multiple columns [boolean] false
fo bulletFour Symbol for 4th level itemized list [string] +
fo bulletOne Symbol for top-level itemized list [string]
fo bulletThree Symbol for 3rd level itemized list [string] *
fo bulletTwo Symbol for 2nd level itemized list [string]
fo columnCount Number of columns, when multiple-column work is requested [integer] 1
fo betweenStarts XSL FO "provisional-distance-between starts" [string] 18pt
fo betweenGlossStarts XSL FO "provisional-distance-between starts" for gloss lists [string] 42pt
fo betweenBiblStarts XSL FO "provisional-distance-between starts" for bibliographies [string] 14pt
fo divRunningheads Display section headings in running heads [boolean] false
fo exampleAfter Space below examples [string] 4pt
fo exampleBefore Space above examples [string] 4pt
fo exampleMargin Left margin for examples [string] 12pt
fo flowMarginLeft Left margin of flow [string]
fo forcePageMaster Which named page master name to use [string]
fo formatBackpage How to format page numbers in back matter (use XSLT number format) [string] 1
fo formatBodypage How to format page numbers in main matter (use XSLT number format) [string] 1
fo formatFrontpage How to format page numbers in front matter (use XSLT number format) [string] i
fo lineheightApplicationRules Set line-height for back matter [string]
fo lineheightBackpage Sequence of identifiers for lineheight application (has to be evaluated as XPath). Add the following values to the sequence in order to: 'p' : apply lineheight to tei:p elements, excluding those in tei:note, and in tei:quote elements returning false from tei:isInline. 'footnote' : in addition to 'p' apply lineheight to all tei:note elements with @place ='foot' 'block-quote' : in addition to 'p' apply lineheight to block quotes 'all' : apply lineheight parameters respectively to the whole page sequences [string] 1
fo lineheightBodypage Set line-height for main matter [string] 1
fo lineheightFrontpage Set line-height for front matter [string] 1
fo frontMulticolumns Put front matter in multiple columns [boolean] false
fo labelSeparation XSL FO "provisional-label-separation" [string] 6pt
fo listAbove-1 Space above lists at top level [string] 6pt
fo listAbove-2 Space above lists at 2nd level [string] 4pt
fo listAbove-3 Space above lists at 3rd level [string] 0pt
fo listAbove-4 Space above lists at 4th level [string] 0pt
fo listBelow-1 Space below lists at top level [string] 6pt
fo listBelow-2 Space below lists at 2nd level [string] 4pt
fo listBelow-3 Space below lists at 3rd level [string] 0pt
fo listBelow-4 Space below lists at 4th level [string] 0pt
fo listItemsep Spacing between list items [string] 4pt
fo listLeftGlossIndent Left margin for gloss lists [string] 0.5in
fo listLeftGlossInnerIndent Left margin for nested gloss lists [string] 0.25in
fo listLeftIndent Indentation for lists [string] 0pt
fo listRightMargin Right margin for lists [string] 10pt
fo pageHeight Paper height [string] 297mm
fo pageMarginBottom Margin at bottom of text area [string] 72pt
fo pageMarginLeft Left margin [string] 72pt
fo pageMarginRight Right margin [string] 72pt
fo pageMarginTop Margin at top of text area [string] 72pt
fo pageWidth Paper width [string] 211mm
fo parSkipmax Maximum space allowed between paragraphs [string] 12pt
fo readColSpecFile External XML file containing specifications for column sizes for tables in document [anyURI]
fo regionAfterExtent Region after [string] 14pt
fo regionBeforeExtent Region before [string] 14pt
fo sectionHeaders Construct running headers from page number and section headings [boolean] true
fo spaceAfterBibl Space after bibliography [string] 0pt
fo spaceAroundTable Space above and below a table [string] 8pt
fo spaceBeforeBibl Space above bibliography [string] 4pt
fo spaceBelowCaption Space below caption of figure or table [string] 4pt
fo titlePage Make title page [boolean] true
fo twoSided Make 2-page spreads [boolean] true
latex classParameters Optional parameters for documentclass [string] 11pt,twoside
latex latexLogo Logo graphics file [string]
latex pagebreakStyle When 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]
latex tableMaxWidth When making a table, what width must be constrained to fit, as a proportion of the page width. [float] 0.85
latex quoteEnv Which environment to use for quotes (quote, quotation, quoting, ...) [string] quote
latex verseNumbering Whether to number lines of poetry [boolean] false
latex everyHowManyLines When numbering poetry, how often to put in a line number [integer] 5
latex resetVerseLineNumbering When numbering poetry, when to restart the sequence; this must be the name of a TEI element [string] div1
latex latexPaperSize LaTeX paper size [] a4paper

6.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-col"  title="Go to main page contentclass="skiplinks"    xmlns:html="http://www.w3.org/1999/xhtml">Skip links</xhtml:a> <xhtml:a class="hide">  <xsl:value-of select="$separator"/> </xhtml:a> <xsl:call-template name="crumbPath"/> <xhtml:a class="hide">  <xsl:value-of select="$separator"/> </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="currentID"   select="$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="https://www.tei-c.org/Stylesheets/"    xmlns:html="http://www.w3.org/1999/xhtml">  <xhtml:img src="https://www.tei-c.org/release/common/doc/tei-xsl-common/teixsl.png"   vspace="5width="124height="161border="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:generateMetadataAuthor(.)"/>  </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='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.Format"    content="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', 'html')) 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:value-of select="$separator"/>      </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="98class="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="currentID"   select="$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{graphicx} \usepackage{marginnote} \renewcommand{\@cite}[1]{#1} </xsl:text> <xsl:if test="not($marginFont='')">\renewcommand*{\marginfont}{<xsl:value-of select="$marginFont"/>} </xsl:if> <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{</xsl:text> <xsl:value-of select="$pageStyle"/> <xsl:text>} </xsl:text> \usepackage[pdftitle={<xsl:sequence select="tei:generateSimpleTitle(.)"/>}, pdfauthor={<xsl:sequence select="replace(string-join(tei:generateAuthor(.),''),'\\[A-z]+','')"/>}]{hyperref} \hyperbaseurl{<xsl:value-of select="$baseURL"/>} <xsl:if test="count(key('APP',1))>0">\usepackage[noreledmac]{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{wrapfig} \usepackage{ifxetex} \ifxetex \usepackage{fontspec} \usepackage{xunicode} \catcode`⃥=\active \def⃥{\textbackslash} \catcode`❴=\active \def❴{\{} \catcode`❵=\active \def❵{\}} \def\textJapanese{\fontspec{<xsl:value-of select="$japaneseFont"/>}} \def\textChinese{\fontspec{<xsl:value-of select="$chineseFont"/>}} \def\textKorean{\fontspec{<xsl:value-of select="$koreanFont"/>}} \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\persName{}\def\name{} \def\placeName{} \def\orgName{} \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\thesection{\@roman\c@section} \def\theHsection{\roman{section}} \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\thesection{\@arabic\c@section} \def\theHsection{\arabic{section}} } \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}% \phantomsection\label{#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 \newcommand*{\cleartoleftpage}{% \clearpage \if@twoside \ifodd\c@page \hbox{}\newpage \if@twocolumn \hbox{}\newpage \fi \fi \fi } \makeatother \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{</xsl:text> <xsl:value-of select="$hyperSetup"/> <xsl:text>} \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

6.3. Headings

Headings for sections can be customized in various ways.

6.3.1. Variables

Type Name Description Default
autoHead Whether to construct a heading for <div> elements with no <head> - by default, not. [boolean] false
numberSpacer Character to put after number of section header [string]
<xsl:text    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>

6.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:docDate"    mode="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"/>

6.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.

6.4.1. Variables

Type Name Description Default
numberBackFigures Automatically number figures in back matter [boolean] false
numberBackHeadings How to construct heading numbering in back matter [string] A.1
numberBackTables Automatically number tables in back matter [boolean] true
numberFigures Automatically number figures [boolean] true
numberFrontFigures Automatically number figures in front matter [boolean] false
numberFrontHeadings How to construct heading numbering in front matter [string]
numberFrontTables Automatically number tables in front matter [boolean] true
numberHeadings Automatically number sections [boolean] true
numberHeadingsDepth Depth to which sections should be numbered [integer] 9
numberTables Automatically number tables [boolean] true
prenumberedHeadings Use value of "n" attribute to number sections [boolean] false
numberParagraphs Automatically number paragraphs. [boolean] false

6.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.1level="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>

6.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.

6.5.1. Variables

Type Name Description Default
outputTarget Type of output being generated [string] html
REQUEST The complete URL when the document is being delivered from a web server (normally set by Apache or Cocoon) [string]
STDOUT Write to standard output channel [boolean] true
html ID An ID passed to the stylesheet to indicate which section to display [string]
html requestedID A 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"/>
html URLPREFIX A path fragment to put before all internal URLs [string]
html outputName The name of the output file [string]
html outputDir Directory in which to place generated files. [string]
html outputEncoding Encoding of output file(s). [string] UTF-8
html outputMethod Output method for output file(s). [string] xhtml
html htmlVersion HTML version of output file(s). [string] 5.0
html normalizationForm Normalization form of output file(s). [string] NFC
html omitXMLDeclaration Omission of XML declaration in output file(s). [string] yes
html outputSuffix Suffix of output file(s). [string] .html
html doctypePublic Public Doctype of output file(s). [string] -//W3C//DTD XHTML 1.0 Transitional//EN
html doctypeSystem System Doctype of output file(s). [string] http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
html pageLayout The 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
html splitBackmatter Break back matter into separate HTML pages (if splitting enabled). [boolean] true
html splitFrontmatter Break front matter into separate HTML pages (if splitting enabled). [boolean] true
html splitLevel Level 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
html standardSuffix Suffix 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>
html topNavigationPanel Display navigation panel at top of pages. [boolean] true
html urlChunkPrefix How 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=
html useIDs Construct 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
fo foEngine Name 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]
fo language Language (for hyphenation). This was originally en_US, but that's invalid and causes trouble, so it's now set to the default 'en' (MDH 2017-04-14). [string]
latex ORIGDIR location of original XML file, for looking up relative pointers [string]
latex baseURL URL root where referenced documents are located [string]
latex realFigures Use real name of graphics files rather than pointers [boolean] true

6.5.2. Templates

6.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.

6.6.1. Variables

Type Name Description Default
html autoToc Make an automatic table of contents [boolean] true
html class_subtoc CSS class for second-level TOC entries [string] subtoc
html subTocDepth Depth 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
html tocBack Include the back matter in the table of contents. [boolean] true
html tocDepth Depth to which table of contents is constructed. [string] 5
html tocFront Include the front matter in the table of contents. [boolean] true
html tocElement Which HTML element to wrap each TOCs entry in. [string] p
html tocContainerElement Which HTML element to wrap each TOC sections in. [string] div
html refDocFooterText Text to link back to from foot of ODD reference pages [string] TEI Guidelines
html refDocFooterURL URL to link back to from foot of ODD reference pages [anyURI] index.html
fo div0Tocindent Indentation for level 0 TOC entries [string] 0in
fo div1Tocindent Indentation for level 1 TOC entries [string] 0.25in
fo div2Tocindent Indentation for level 2 TOC entries [string] 0.5in
fo div3Tocindent Indentation for level 3 TOC entries [string] 0.75in
fo div4Tocindent Indentation for level 4 TOC entries [string] 1in
fo div5Tocindent Indentation for level 5 TOC entries [string] 1.25in
fo tocBack Make TOC for sections in <back> [boolean] true
fo tocFront Make TOC for sections in <front> [boolean] true
fo tocNumberSuffix Punctuation to insert after a section number in a TOC [string] .
fo tocStartPage Page number on which TOC should start [integer] 1
fo tocJustify TOC justify [boolean] false
fo tocLeaderPattern TOC leader pattern, options are: - rule A rule. If this choice is selected, the "rule-thickness" and "rule-style" properties are used to set the leader's style. - dots A repeating sequence of dots. The choice of dot character is dependent on the user agent. - use-content A repeating pattern as specified by $tocLeaderPatternContent. inherit [string] space
fo tocLeaderPatternContent TOC leader pattern content, will only be applied if $tocLeaderPattern is set to 'use-content' [string] -.

6.7. Internationalization

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

6.7.1. Templates

copyrightStatement
[html] Make a copyright claim

6.8. CSS

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

6.8.1. Variables

Type Name Description Default
class_toc CSS class for TOC entries [string] toc
html class_ptr CSS class for links derived from <ptr> [string] ptr
html class_ref CSS class for links derived from <ref> [string] ref
html cssFile CSS style file to be associated with output file(s) [anyURI] https://www.tei-c.org/release/xml/tei/stylesheet/tei.css
html cssPrintFile CSS style file for print; this will be given a media=print attribute. [anyURI] https://www.tei-c.org/release/xml/tei/stylesheet/tei-print.css
html cssSecondaryFile Secondary 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]
html cssInlineFiles CSS file to include in the output file directly [anyURI]

6.9. Tables

Default behaviour of table elements.

6.9.1. Variables

Type Name Description Default
cellAlign Default alignment of table cells [string] left
tableAlign Default alignment of tables [string] left
fo defaultCellLabelBackground Default colour for background of table cells which are labelling rows or columns [string] silver
fo inlineTables Force tables to appear inline [boolean] false
fo makeTableCaption Put a caption on tables [boolean] true
fo tableCaptionAlign Alignment of table captions [string] center
fo tableCellPadding Default padding on table cells [string] 2pt

6.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.

6.10.1. Variables

Type Name Description Default
graphicsPrefix Directory specification to put before names of graphics files, unless they start with "./" [string]
graphicsSuffix Default file suffix for graphics files, if not directly specified [string] .png
standardScale Scaling of imported graphics [decimal] 1
headInXref [common] Whether cross-reference to a figure or table includes its caption [boolean] true
html dpi Resolution of images. This is needed to calculate HTML width and height (in pixels) from supplied dimensions. [integer] 96
html showFigures Display figures. [boolean] true
fo autoScaleFigures How to scale figures if no width and height specified (pass to XSL FO content-width) [string]
fo captionInlineFigures Put captions on inline figures [boolean] false
fo showFloatHead Show the contents of <head> in a cross-reference to table or figure [boolean] false
fo showFloatLabel Show a title for figures or tables (eg Table or Figure) in a cross-reference [boolean] false
fo xrefShowPage Show the page number in a cross-reference to table or figure [boolean] false

6.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>

6.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.

6.11.1. Variables

Type Name Description Default
pagebreakStyle Display of <pb> element. Choices are "active" or "none"; the default is to put in a display of the page break [string] visible
displayMode How to display Relax NG schema fragments (rnc or rng) [string] rnc
minimalCrossRef Provide minimal context for a link [boolean] false
postQuote Character to insert at end of quote. [string]
preQuote Character to insert at start of quote [string]
html urlMarkup HTML element to put around visible text of display URLs [string] span
fo activeLinebreaks Make <lb> active (ie cause a line break) [boolean] true
fo alignment Alignment of text (ie justified or ragged) [string] justify
fo biblSize Font size for bibliography [string] 16pt
fo bodyFont Default font for body [string] Times
fo bodyMaster Default font size for body (without dimension) [string] 10
fo bodySize Calculation 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>
fo divFont Font for section headings [string] Times
fo exampleColor Colour for display of <eg> blocks. [string] black
fo exampleBackgroundColor Colour for background display of <eg> blocks. [string] lightgray
fo exampleSize Calculation 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>
fo quoteSize Calculation 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>
fo footnoteSize Font size for footnotes [string]
<xsl:value-of select="$bodyMaster * 0.9"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text>pt</xsl:text>
fo footnotenumSize Font size for footnote numbers [string]
<xsl:value-of select="$bodyMaster * 0.7"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text>pt</xsl:text>
fo giColor Colour for display of element names [string] black
fo headingOutdent Indentation of headings [string] 0em
fo hyphenate Hyphenate text [boolean] true
fo identColor Colour for display of <ident> values Customization parameter. [string] black
fo runFont Font family for running header and footer [string] sans-serif
fo runSize Font size for running header and footer [string] 9pt
fo sansFont Sans-serif font [string] Helvetica
fo smallSize Calculation 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>
fo tableSize Create 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>
fo tocSize Font size for TOC heading [string] 16pt
fo typewriterFont Font for literal code [string] Courier
latex exampleFont Font for examples [string] Courier New
latex typewriterFont Font for literal code [string] DejaVu Sans Mono
latex sansFont Font for sans-serif [string]
latex romanFont Font for serif [string]
latex gothicFont Font for gothic [string] Lucida Blackletter
latex calligraphicFont Font for calligraphic [string] Lucida Calligraphy
latex marginFont Command to set margin font [string] \itshape\footnotesize
latex chineseFont Font for Chinese script [string] Noto Sans CJK SC
latex koreanFont Font for Korean script [string] Noto Sans CJK KR
latex japaneseFont Font for Japanese script [string] Noto Sans CJK JP

6.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="section"   select="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"/>

6.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.

6.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

6.13. Miscellaneous and advanced

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

6.13.1. Variables

Type Name Description Default
teixslHome The home page for these stylesheets [anyURI] http://www.tei-c.org/Stylesheets/
teiP4Compat Process elements according to assumptions of TEI P4 [boolean] false
html generateParagraphIDs Generate a unique ID for all paragraphs [boolean] false
html showTitleAuthor Show a title and author at start of document [boolean] false
html generationComment Add a comment to web page showing when it was generated, stylesheet version, etc [boolean] true
html verbose Be talkative while working. [boolean] false

7. 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: 2014-11-12