Stylesheet
core.xsl
Documentation
Description
TEI stylesheet dealing with elements from the core module, making
HTML output.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version. This library is
distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details. You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author: See AUTHORS
Id: $Id: core.xsl 7901 2010-07-25 11:43:34Z rahtz $
Copyright: 2008, TEI Consortium
Included from
Stylesheet version
2.0
Template
tei:* maketoc
Documentation
Description
Process elements tei:*
anything with a head can go in the TOC
Parameters
forcedepth forcedepth
Namespace
No namespace
Match
tei:*
Mode
maketoc
References
Parameters
QName
Namespace
forcedepth
No namespace
Import precedence
3
Source
<xsl:template match= "tei:*" mode= "maketoc" >
<xsl:param name= "forcedepth" />
<xsl:variable name= "myName" >
<xsl:value-of select= "local-name(.)" />
</xsl:variable>
<xsl:if test= "tei:head or $autoHead='true'" >
<xsl:variable name= "Depth" >
<xsl:choose >
<xsl:when test= "not($forcedepth='')" >
<xsl:value-of select= "$forcedepth" />
</xsl:when>
<xsl:otherwise >
<xsl:value-of select= "$tocDepth" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name= "thislevel" >
<xsl:choose >
<xsl:when test= "$myName = 'div'" >
<xsl:value-of select= "count(ancestor::tei:div)" />
</xsl:when>
<xsl:when test= "starts-with($myName,'div')" >
<xsl:value-of select= "number(substring-after($myName,'div')) - 1" />
</xsl:when>
<xsl:otherwise > 99 </xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name= "pointer" >
<xsl:apply-templates mode= "generateLink" select= "." />
</xsl:variable>
<li class= "toc" >
<xsl:call-template name= "header" >
<xsl:with-param name= "toc" select= "$pointer" />
<xsl:with-param name= "minimal" > false </xsl:with-param>
<xsl:with-param name= "display" > plain </xsl:with-param>
</xsl:call-template>
<xsl:if test= "$thislevel < $Depth" >
<xsl:call-template name= "continuedToc" />
</xsl:if>
</li>
</xsl:if>
</xsl:template>
Stylesheet location
../../../xhtml2/core.xsl
Template
tei:ab
Template
tei:addrLine
Template
tei:address
Template
tei:bibl
Template
tei:byline
Template
tei:change
Template
tei:choice
Template
tei:cit
Documentation
Description
Process element cit
quoting
Namespace
No namespace
Match
tei:cit
Mode
#default
References
Import precedence
3
Source
<xsl:template match= "tei:cit" >
<xsl:choose >
<xsl:when test= "@rend='display'" >
<blockquote >
<xsl:call-template name= "rendToClass" />
<p >
<xsl:if test= "@n" >
<xsl:text > ( </xsl:text>
<xsl:value-of select= "@n" />
<xsl:text > ) </xsl:text>
</xsl:if>
<xsl:apply-templates select= "tei:q|tei:quote" />
<xsl:apply-templates select= "tei:bibl" />
</p>
</blockquote>
</xsl:when>
<xsl:when test= "tei:bibl" >
<div >
<xsl:call-template name= "rendToClass" />
<xsl:if test= "@n" >
<xsl:text > ( </xsl:text>
<xsl:value-of select= "@n" />
<xsl:text > ) </xsl:text>
</xsl:if>
<xsl:apply-templates />
</div>
</xsl:when>
<xsl:otherwise >
<span >
<xsl:call-template name= "rendToClass" />
<xsl:if test= "@n" >
<xsl:text > ( </xsl:text>
<xsl:value-of select= "@n" />
<xsl:text > ) </xsl:text>
</xsl:if>
<xsl:apply-templates />
</span>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Stylesheet location
../../../xhtml2/core.xsl
Template
tei:code
Template
tei:corr
Template
tei:del
Template
tei:eg
Template
tei:emph
Template
tei:epigraph
Template
tei:epigraph/tei:lg
Template
tei:foreign|tei:unclear
Template
tei:caesura
Template
tei:gap
Template
tei:gi
Documentation
Description
Process element gi
special purpose
Namespace
No namespace
Match
tei:gi
Mode
#default
Import precedence
3
Source
<xsl:template match= "tei:gi" >
<span class= "gi" >
<xsl:text > < </xsl:text>
<xsl:apply-templates />
<xsl:text > > </xsl:text>
</span>
</xsl:template>
Stylesheet location
../../../xhtml2/core.xsl
Template
tei:gi plain
Template
tei:att
Documentation
Description
Process element att
special purpose
Namespace
No namespace
Match
tei:att
Mode
#default
Import precedence
3
Source
<xsl:template match= "tei:att" >
<span class= "gi" >
<b > @ <xsl:apply-templates />
</b>
</span>
</xsl:template>
Stylesheet location
../../../xhtml2/core.xsl
Template
tei:gloss
Template
tei:head
Documentation
Description
Process element head
headings etc
Namespace
No namespace
Match
tei:head
Mode
#default
References
Import precedence
3
Source
<xsl:template match= "tei:head" >
<xsl:variable name= "parent" select= "local-name(..)" />
<xsl:choose >
<xsl:when test= "parent::tei:body" >
<h1 >
<xsl:call-template name= "rendToClass" />
<xsl:apply-templates />
</h1>
</xsl:when>
<xsl:when test= "not(starts-with($parent,'div'))" >
<xsl:apply-templates />
</xsl:when>
</xsl:choose>
</xsl:template>
Stylesheet location
../../../xhtml2/core.xsl
Template
tei:head plain
Template
tei:head makeheading
Template
tei:hi
Template
tei:ident
Template
tei:item bibl
Template
tei:item glosstable
Template
tei:item gloss
Template
tei:item
Template
tei:item inline
Template
tei:item/tei:label
Template
tei:l Copying
Template
tei:l[@copyOf]|lg[@copyOf]
Documentation
Description
Process element l[@copyOf]|lg[@copyOf]
copyOf handling
Namespace
No namespace
Match
tei:l[@copyOf]|lg[@copyOf]
Mode
#default
References
Import precedence
3
Source
<xsl:template match= "tei:l[@copyOf]|lg[@copyOf]" >
<xsl:variable name= "W" >
<xsl:choose >
<xsl:when test= "starts-with(@copyof,'#')" >
<xsl:value-of select= "substring-after(@copyof,'#')" />
</xsl:when>
<xsl:otherwise >
<xsl:value-of select= "@copyof" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:apply-templates mode= "Copying" select= "key('IDS',$W)" />
</xsl:template>
Stylesheet location
../../../xhtml2/core.xsl
Template
tei:label
Template
tei:label print
Template
tei:lb
Template
tei:l
Template
tei:lg
Template
tei:lg/tei:l
Template
tei:lg Copying
Template
tei:list
Documentation
Description
Process element list
Lists. Depending on the value of the 'type' attribute, various HTML
lists are generated:
bibl
Items are processed in mode 'bibl'
catalogue
A gloss list is created, inside a paragraph
gloss
A gloss list is created, expecting alternate label and item
elements
glosstable
Label and item pairs are laid out in a two-column table
inline
A comma-separate inline list
runin
An inline list with bullets between items
unordered
A simple unordered list
ordered
A simple ordered list
valList
(Identical to glosstable)
Namespace
No namespace
Match
tei:list
Mode
#default
References
Import precedence
3
Source
<xsl:template match= "tei:list" >
<xsl:if test= "tei:head" >
<p class= "listhead" >
<xsl:apply-templates select= "tei:head" />
</p>
</xsl:if>
<xsl:choose >
<xsl:when test= "@type='catalogue'" >
<p >
<dl >
<xsl:call-template name= "rendToClass" >
<xsl:with-param name= "default" />
</xsl:call-template>
<xsl:for-each select= "tei:item" >
<p />
<xsl:apply-templates mode= "gloss" select= "." />
</xsl:for-each>
</dl>
</p>
</xsl:when>
<xsl:when test= "@type='gloss' and @rend='multicol'" >
<xsl:variable name= "nitems" >
<xsl:value-of select= "count(tei:item)div 2" />
</xsl:variable>
<p >
<table >
<xsl:call-template name= "rendToClass" >
<xsl:with-param name= "default" />
</xsl:call-template>
<tr >
<td valign= "top" >
<dl >
<xsl:apply-templates mode= "gloss" select= "tei:item[position()<=$nitems ]" />
</dl>
</td>
<td valign= "top" >
<dl >
<xsl:apply-templates mode= "gloss" select= "tei:item[position() >$nitems]" />
</dl>
</td>
</tr>
</table>
</p>
</xsl:when>
<xsl:when test= "@type='gloss' or tei:label" >
<dl >
<xsl:call-template name= "rendToClass" >
<xsl:with-param name= "default" />
</xsl:call-template>
<xsl:apply-templates mode= "gloss" select= "tei:item" />
</dl>
</xsl:when>
<xsl:when test= "@type='glosstable' or @type='valList'" >
<table >
<xsl:call-template name= "rendToClass" >
<xsl:with-param name= "default" />
</xsl:call-template>
<xsl:apply-templates mode= "glosstable" select= "tei:item" />
</table>
</xsl:when>
<xsl:when test= "@type='inline'" >
<!--<xsl:if test="not(tei:item)">None</xsl:if>-->
<xsl:apply-templates mode= "inline" select= "tei:item" />
</xsl:when>
<xsl:when test= "@type='runin'" >
<p >
<xsl:apply-templates mode= "runin" select= "tei:item" />
</p>
</xsl:when>
<xsl:when test= "@type='unordered' or @type='simple'" >
<ul >
<xsl:call-template name= "rendToClass" >
<xsl:with-param name= "default" />
</xsl:call-template>
<xsl:apply-templates select= "tei:item" />
</ul>
</xsl:when>
<xsl:when test= "@type='bibl'" >
<xsl:apply-templates mode= "bibl" select= "tei:item" />
</xsl:when>
<xsl:when test= "starts-with(@type,'ordered')" >
<ol >
<xsl:call-template name= "rendToClass" >
<xsl:with-param name= "default" />
</xsl:call-template>
<xsl:if test= "starts-with(@type,'ordered:')" >
<xsl:attribute name= "start" >
<xsl:value-of select= "substring-after(@type,':')" />
</xsl:attribute>
</xsl:if>
<xsl:apply-templates select= "tei:item" />
</ol>
</xsl:when>
<xsl:otherwise >
<ul >
<xsl:call-template name= "rendToClass" >
<xsl:with-param name= "default" />
</xsl:call-template>
<xsl:apply-templates select= "tei:item" />
</ul>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Stylesheet location
../../../xhtml2/core.xsl
Template
tei:list/tei:label
Template
tei:listBibl
Template
tei:mentioned
Template
tei:name plain
Template
tei:note
Template
tei:note printallnotes
Template
tei:note printnotes
Template
makeaNote
Template
tei:note[@type='action']
Template
tei:pb
Template
tei:p
Template
tei:p[@rend='box']
Template
tei:q|tei:said
Template
tei:q[@rend='display']
Template
tei:q[@rend='eg']
Template
tei:quote
Template
tei:resp
Template
tei:respStmt
Template
tei:salute
Template
tei:seg
Template
tei:sic
Template
tei:signed
Template
tei:space
Template
tei:term
Template
tei:title withbr
Template
tei:body/tei:title
Template
tei:witList
Template
tei:witness
Template
applyRendition
Template
findRendition
Template
applyRend
Template
continuedToc
Template
noteID
Template
noteN
Template
partialFootNotes
Documentation
Namespace
No namespace
Used by
References
Parameters
Import precedence
3
Source
Stylesheet location
../../../xhtml2/core.xsl
Template
printNotes
Template
rendering
Template
renderingInner
Template
space_loop
Template
unknownRendBlock
Template
unknownRendInline
Template
makeAnchor
Template
tei:soCalled
Template
htmlAttributes
Template
rendToClass
Template
rendToClassHook