Mode:

Compact lists

Showing:

Documentation
Parameters
Used by
References
Imported from
Source
Stylesheet functions.xsl
Documentation

Description

TEI Utility stylesheet defining functions for use in all output formats.

This software is dual-licensed: 1. Distributed under a Creative Commons Attribution-ShareAlike 3.0 Unported License http://creativecommons.org/licenses/by-sa/3.0/ 2. http://www.opensource.org/licenses/BSD-2-Clause Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. This software is provided by the copyright holders and contributors "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright holder or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.

Author: See AUTHORS

Copyright: 2013, TEI Consortium

Imported from
Stylesheet version 2.0
Template text()#default plain
Documentation

Description

[common] handle character data. Following http://wiki.tei-c.org/index.php/XML_Whitespace#XSLT_Normalization_Code, the algorithm to normalize space in mixed content is: Collapse all white space, then trim leading space on the first text node in an element and trim trailing space on the last text node in an element, trim both if a text node is both first and last, i.e., is the only text node in the element.
Namespace No namespace
Match text()
Mode #default plain
References
Import precedence 0
Source
<xsl:template match="text()" mode="#default plain">
  <xsl:choose>
    <xsl:when test="ancestor::*[@xml:space][1]/@xml:space='preserve'">
      <xsl:value-of select="tei:escapeChars(.,parent::*)"/>
    </xsl:when>
    <xsl:otherwise>
      <!-- Retain one leading space if node isn't first, has
	     non-space content, and has leading space.-->
      <xsl:variable name="context" select="name(parent::*)"/>
      <xsl:if test="matches(.,'^\s') and  normalize-space()!=''">
        <!-- if the text is first thing in a note, zap it,  definitely -->
        <xsl:choose>
          <xsl:when test="(tei:isFootNote(..) or tei:isEndNote(..))        and position()=1"/>
          <!-- but if its in a run on inline objects with the same
	    name (like a sequence of <hi>), then the space needs
	    keeping -->
          <xsl:when test="(tei:isInline(parent::*)  and parent::*/preceding-sibling::node()[1][name()=$context])">
            <xsl:call-template name="space"/>
          </xsl:when>
          <xsl:when test="position()=1"/>
          <xsl:otherwise>
            <xsl:call-template name="space"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:if>
      <xsl:value-of select="tei:escapeChars(normalize-space(.),parent::*)"/>
      <xsl:choose>
        <!-- node is an only child, and has content but it's all space -->
        <xsl:when test="last()=1 and string-length()!=0 and      normalize-space()=''">
          <xsl:call-template name="space"/>
        </xsl:when>
        <!-- node isn't last, isn't first, and has trailing space -->
        <xsl:when test="position()!=1 and position()!=last() and matches(.,'\s$')">
          <xsl:call-template name="space"/>
        </xsl:when>
        <!-- node isn't last, is first, has trailing space, and has non-space content   -->
        <xsl:when test="position()=1 and matches(.,'\s$') and normalize-space()!=''">
          <xsl:call-template name="space"/>
        </xsl:when>
      </xsl:choose>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
Stylesheet location ../../../common/functions.xsl
Template space
Namespace No namespace
Used by
Import precedence 0
Source
<xsl:template name="space">
  <xsl:text> </xsl:text>
</xsl:template>
Stylesheet location ../../../common/functions.xsl
Template myi18n
Documentation

Description

[localisation] dummy template for overriding in a local system

Parameters

word the word(s) to translate
Namespace No namespace
Used by
Function
Parameters
QName Namespace
word No namespace
Import precedence 0
Source
<xsl:template name="myi18n">
  <xsl:param name="word"/>
</xsl:template>
Stylesheet location ../../../common/functions.xsl
Template i18n
Documentation

Description

[localisation] wrapper for legacy support
Namespace No namespace
References
Function
Parameters
QName Namespace
word No namespace
Import precedence 0
Source
<xsl:template name="i18n">
  <xsl:param name="word"/>
  <xsl:sequence select="tei:i18n($word)"/>
</xsl:template>
Stylesheet location ../../../common/functions.xsl
Template whatsTheDate
Documentation

Description

[common] work out the date and time, unless we have been told not to
Namespace No namespace
References
Parameter
Import precedence 0
Source
<xsl:template name="whatsTheDate">
  <xsl:choose>
    <xsl:when test="$useFixedDate='true'">1970-01-01</xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="format-dateTime(current-dateTime(),'[Y]-[M02]-[D02]T[H02]:[m02]:[s02]Z')"/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
Stylesheet location ../../../common/functions.xsl
Parameter oddmode
Namespace No namespace
Used by
Source
<xsl:param name="oddmode">tei</xsl:param>
Stylesheet location ../../../common/functions.xsl
Parameter ignoreXmlBase
Namespace No namespace
Used by
Source
<xsl:param name="ignoreXmlBase">false</xsl:param>
Stylesheet location ../../../common/functions.xsl
Parameter selectedSchema
Namespace No namespace
Used by
Variable
Source
<xsl:param name="selectedSchema"/>
Stylesheet location ../../../common/functions.xsl
Parameter doclang
Namespace No namespace
Used by
Source
<xsl:param name="doclang"/>
Stylesheet location ../../../common/functions.xsl
Parameter useFixedDate
Documentation

Description

Whether to attempt to work out a current date (set to true for test results which won't differ
Namespace No namespace
Used by
Source
<xsl:param name="useFixedDate">false</xsl:param>
Stylesheet location ../../../common/functions.xsl
Parameter wordDirectory
Namespace No namespace
Source
<xsl:param name="wordDirectory"/>
Stylesheet location ../../../common/functions.xsl
Parameter splitLevel
Namespace No namespace
Source
<xsl:param name="splitLevel">-1</xsl:param>
Stylesheet location ../../../common/functions.xsl
Parameter useHeaderFrontMatter
Documentation

Description

Title, author and date is taken from the <teiHeader> rather than looked for in the front matter
Namespace No namespace
Used by
Source
<xsl:param name="useHeaderFrontMatter">false</xsl:param>
Stylesheet location ../../../common/functions.xsl
Parameter autoBlockQuote
Documentation

Description

Whether it should be attempted to make quotes into block quotes if they are over a certain length
Namespace No namespace
Used by
Source
<xsl:param name="autoBlockQuote">false</xsl:param>
Stylesheet location ../../../common/functions.xsl
Parameter autoBlockQuoteLength
Documentation

Description

Length beyond which a quote is a block quote
Namespace No namespace
Used by
Source
<xsl:param name="autoBlockQuoteLength">150</xsl:param>
Stylesheet location ../../../common/functions.xsl
Parameter documentationLanguage
Namespace No namespace
Used by
Function
Source
<xsl:param name="documentationLanguage">en</xsl:param>
Stylesheet location ../../../common/functions.xsl
Variable top
Namespace No namespace
Select /
Used by
Source
<xsl:variable name="top" select="/"/>
Stylesheet location ../../../common/functions.xsl
Variable whichSchemaSpec
Namespace No namespace
Used by
References
Parameter
Key
Source
<xsl:variable name="whichSchemaSpec">
  <xsl:choose>
    <xsl:when test="$selectedSchema">
      <xsl:value-of select="$selectedSchema"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="key('SCHEMASPECS',1)[1]/@ident"/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:variable>
Stylesheet location ../../../common/functions.xsl
Variable i18n
Namespace No namespace
Select document('../i18n.xml',document(''))
Used by
Function
Source
<xsl:variable name="i18n" select="document('../i18n.xml',document(''))"/>
Stylesheet location ../../../common/functions.xsl
Function tei:isIdentifiable (element)
Documentation

Description

Whether a section is "identifiable"
Namespace http://www.tei-c.org/ns/1.0
Type xs:boolean
Parameters
QName Namespace
element No namespace
Import precedence 0
Source
<xsl:function name="tei:isIdentifiable" as="xs:boolean">
  <xsl:param name="element"/>
  <xsl:for-each select="$element">
    <xsl:choose>
      <xsl:when test="self::tei:div">true</xsl:when>
      <xsl:when test="self::tei:div1">true</xsl:when>
      <xsl:when test="self::tei:div2">true</xsl:when>
      <xsl:when test="self::tei:div3">true</xsl:when>
      <xsl:when test="self::tei:div4">true</xsl:when>
      <xsl:when test="self::tei:div5">true</xsl:when>
      <xsl:when test="self::tei:div6">true</xsl:when>
      <xsl:when test="self::tei:p[@xml:id]">true</xsl:when>
      <xsl:when test="self::tei:index[@xml:id]">true</xsl:when>
      <xsl:otherwise>false</xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:isTranscribable (element)
Documentation

Description

Whether a section is "transcribable"
Namespace http://www.tei-c.org/ns/1.0
Type xs:boolean
Parameters
QName Namespace
element No namespace
Import precedence 0
Source
<xsl:function name="tei:isTranscribable" as="xs:boolean">
  <xsl:param name="element"/>
  <xsl:for-each select="$element">
    <xsl:choose>
      <xsl:when test="self::tei:p and parent::tei:sp">true</xsl:when>
      <xsl:when test="self::tei:l">true</xsl:when>
      <xsl:otherwise>false</xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:render-smallcaps (element)
Documentation

Description

Whether to render text in small caps.
Namespace http://www.tei-c.org/ns/1.0
Type xs:boolean
References
Parameters
QName Namespace
element No namespace
Import precedence 0
Source
<xsl:function name="tei:render-smallcaps" as="xs:boolean">
  <xsl:param name="element"/>
  <xsl:for-each select="$element">
    <xsl:choose>
      <xsl:when test="ancestor-or-self::*[@rend][tei:match(@rend,'smallcaps')]">true</xsl:when>
      <xsl:when test="ancestor-or-self::*[@rend][tei:match(@rend,'sc')]">true</xsl:when>
      <xsl:otherwise>false</xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:render-quotes (element)
Documentation

Description

Whether to render text in smart quotes.
Namespace http://www.tei-c.org/ns/1.0
Type xs:boolean
References
Parameters
QName Namespace
element No namespace
Import precedence 0
Source
<xsl:function name="tei:render-quotes" as="xs:boolean">
  <xsl:param name="element"/>
  <xsl:for-each select="$element">
    <xsl:choose>
      <xsl:when test="self::tei:soCalled">true</xsl:when>
      <xsl:when test="ancestor-or-self::*[@rend][tei:match(@rend,'quotes')]">true</xsl:when>
      <xsl:otherwise>false</xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:render-bold (element)
Documentation

Description

Whether to render text in bold.
Namespace http://www.tei-c.org/ns/1.0
Type xs:boolean
References
Parameters
QName Namespace
element No namespace
Import precedence 0
Source
<xsl:function name="tei:render-bold" as="xs:boolean">
  <xsl:param name="element"/>
  <xsl:for-each select="$element">
    <xsl:choose>
      <xsl:when test="tei:match(@rend,'odd_label')">true</xsl:when>
      <xsl:when test="parent::tei:hi[starts-with(@rend,'specList-')]">true</xsl:when>
      <xsl:when test="self::tei:docAuthor">true</xsl:when>
      <xsl:when test="self::tei:label[following-sibling::tei:item]">true</xsl:when>
      <xsl:when test="starts-with(@rend,'specList-')">true</xsl:when>
      <xsl:when test="starts-with(parent::tei:hi/@rend,'specList-')">true</xsl:when>
      <xsl:when test="tei:match(@rend,'label')">true</xsl:when>
      <xsl:when test="tei:match(@rend,'wovenodd')">true</xsl:when>
      <xsl:when test="tei:match(@rend,'important')">true</xsl:when>
      <xsl:when test="tokenize(@rend,' ')=('Heading_2_Char')">true</xsl:when>
      <xsl:when test="tei:match(@rend,'specChildModule')">true</xsl:when>
      <xsl:when test="ancestor-or-self::tei:cell[tei:match(@rend,'wovenodd-col1')]">true</xsl:when>
      <xsl:when test="ancestor-or-self::tei:cell[@role='label']">true</xsl:when>
      <xsl:when test="ancestor-or-self::*[@rend][tei:match(@rend,'bold')]">true</xsl:when>
      <xsl:when test="parent::tei:hi[starts-with(@rend,'specList-')]">true</xsl:when>
      <xsl:when test="self::tei:cell and parent::tei:row[@role='label']">true</xsl:when>
      <xsl:when test="self::tei:label[following-sibling::tei:item]">true</xsl:when>
      <xsl:otherwise>false</xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:render-color (element)
Documentation

Description

Whether to render something in color.
Namespace http://www.tei-c.org/ns/1.0
Type xs:string*
Parameters
QName Namespace
element No namespace
Import precedence 0
Source
<xsl:function name="tei:render-color" as="xs:string*">
  <xsl:param name="element"/>
  <xsl:for-each select="$element">
    <xsl:for-each select="ancestor-or-self::*[@rend][matches(@rend,'color\(')]">
      <xsl:analyze-string select="@rend" regex="color\(([^\)]+)">
        <xsl:matching-substring>
          <xsl:value-of select="regex-group(1)"/>
        </xsl:matching-substring>
      </xsl:analyze-string>
    </xsl:for-each>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:render-backgroundcolor (element)
Documentation

Description

Whether to render something with background color.
Namespace http://www.tei-c.org/ns/1.0
Type xs:string*
Parameters
QName Namespace
element No namespace
Import precedence 0
Source
<xsl:function name="tei:render-backgroundcolor" as="xs:string*">
  <xsl:param name="element"/>
  <xsl:for-each select="$element">
    <xsl:for-each select="ancestor-or-self::*[@rend][matches(@rend,'background\(')]">
      <xsl:analyze-string select="@rend" regex="background\(([^\)]+)">
        <xsl:matching-substring>
          <xsl:value-of select="regex-group(1)"/>
        </xsl:matching-substring>
      </xsl:analyze-string>
    </xsl:for-each>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:render-italic (element)
Documentation

Description

Whether to render something in italic.
Namespace http://www.tei-c.org/ns/1.0
Type xs:boolean
References
Parameters
QName Namespace
element No namespace
Import precedence 0
Source
<xsl:function name="tei:render-italic" as="xs:boolean">
  <xsl:param name="element"/>
  <xsl:for-each select="$element">
    <xsl:choose>
      <xsl:when test="ancestor-or-self::*[@rend][tei:match(@rend,'italic')]">true</xsl:when>
      <xsl:when test="self::tei:emph">true</xsl:when>
      <xsl:when test="self::tei:hi[not(@rend)]">true</xsl:when>
      <xsl:when test="self::tbx:hi[@style='italics']">true</xsl:when>
      <xsl:when test="tei:match(@rend,'ital')">true</xsl:when>
      <xsl:when test="tei:match(@rend,'it')">true</xsl:when>
      <xsl:when test="tei:match(@rend,'i')">true</xsl:when>
      <xsl:when test="tei:match(@rend,'att')">true</xsl:when>
      <xsl:when test="self::tei:att">true</xsl:when>
      <xsl:when test="self::tei:speaker">true</xsl:when>
      <xsl:when test="self::tei:gloss">true</xsl:when>
      <xsl:when test="self::tei:title">true</xsl:when>
      <xsl:when test="self::tei:name">true</xsl:when>
      <xsl:otherwise>false</xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:render-typewriter (element)
Documentation

Description

Whether to render something in typewriter-like code.
Namespace http://www.tei-c.org/ns/1.0
Type xs:boolean
References
Parameters
QName Namespace
element No namespace
Import precedence 0
Source
<xsl:function name="tei:render-typewriter" as="xs:boolean">
  <xsl:param name="element"/>
  <xsl:for-each select="$element">
    <xsl:choose>
      <xsl:when test="self::tei:gi">true</xsl:when>
      <xsl:when test="self::tei:val">true</xsl:when>
      <xsl:when test="self::tei:code">true</xsl:when>
      <xsl:when test="self::tei:ident">true</xsl:when>
      <xsl:when test="ancestor-or-self::*[@rend][tei:match(@rend,'typewriter')]">true</xsl:when>
      <xsl:when test="ancestor-or-self::*[@rend][tei:match(@rend,'code')]">true</xsl:when>
      <xsl:otherwise>false</xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:render-underline (element)
Documentation

Description

Whether to render something in underline.
Namespace http://www.tei-c.org/ns/1.0
Type xs:boolean
References
Parameters
QName Namespace
element No namespace
Import precedence 0
Source
<xsl:function name="tei:render-underline" as="xs:boolean">
  <xsl:param name="element"/>
  <xsl:for-each select="$element">
    <xsl:choose>
      <xsl:when test="ancestor-or-self::*[@rend][tei:match(@rend,'ul')]">true</xsl:when>
      <xsl:when test="ancestor-or-self::*[@rend][tei:match(@rend,'underline')]">true</xsl:when>
      <xsl:when test="ancestor-or-self::*[@rend][tei:match(@rend,'UL')]">true</xsl:when>
      <xsl:otherwise>false</xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:render-superscript (element)
Documentation

Description

Whether to render something in superscript.
Namespace http://www.tei-c.org/ns/1.0
Type xs:boolean
References
Parameters
QName Namespace
element No namespace
Import precedence 0
Source
<xsl:function name="tei:render-superscript" as="xs:boolean">
  <xsl:param name="element"/>
  <xsl:for-each select="$element">
    <xsl:choose>
      <xsl:when test="ancestor-or-self::*[@rend][tei:match(@rend,'sup')]">true</xsl:when>
      <xsl:when test="ancestor-or-self::*[@rend][tei:match(@rend,'superscript')]">true</xsl:when>
      <xsl:otherwise>false</xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:render-subscript (element)
Documentation

Description

Whether to render something in subscript.
Namespace http://www.tei-c.org/ns/1.0
Type xs:boolean
References
Parameters
QName Namespace
element No namespace
Import precedence 0
Source
<xsl:function name="tei:render-subscript" as="xs:boolean">
  <xsl:param name="element"/>
  <xsl:for-each select="$element">
    <xsl:choose>
      <xsl:when test="ancestor-or-self::*[@rend][tei:match(@rend,'sup')]">true</xsl:when>
      <xsl:when test="ancestor-or-self::*[@rend][tei:match(@rend,'subscript')]">true</xsl:when>
      <xsl:otherwise>false</xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:render-strike (element)
Documentation

Description

Whether to render something in strikethrough.
Namespace http://www.tei-c.org/ns/1.0
Type xs:boolean
References
Parameters
QName Namespace
element No namespace
Import precedence 0
Source
<xsl:function name="tei:render-strike" as="xs:boolean">
  <xsl:param name="element"/>
  <xsl:for-each select="$element">
    <xsl:choose>
      <xsl:when test="ancestor-or-self::*[@rend][tei:match(@rend,'strikethrough')]">true</xsl:when>
      <xsl:otherwise>false</xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:isInline (element)
Documentation

Description

Is given an element and defines whether or not this element is to be rendered inline.
Namespace http://www.tei-c.org/ns/1.0
Type xs:boolean
Used by
References
Parameters
QName Namespace
element No namespace
Import precedence 0
Source
<xsl:function name="tei:isInline" as="xs:boolean">
  <xsl:param name="element"/>
  <xsl:choose>
    <xsl:when test="empty($element)">true</xsl:when>
    <xsl:otherwise>
      <xsl:for-each select="$element">
        <xsl:choose>
          <xsl:when test="parent::tei:div">false</xsl:when>
          <xsl:when test="parent::tei:titlePage">false</xsl:when>
          <xsl:when test="parent::tei:body">false</xsl:when>
          <xsl:when test="parent::tei:front">false</xsl:when>
          <xsl:when test="parent::tei:back">false</xsl:when>
          <xsl:when test="self::tei:body">false</xsl:when>
          <xsl:when test="self::tei:front">false</xsl:when>
          <xsl:when test="self::tei:back">false</xsl:when>
          <xsl:when test="not(self::*)">true</xsl:when>
          <xsl:when test="parent::tei:bibl/parent::tei:q">true</xsl:when>
          <xsl:when test="tei:match(@rend,'inline') and not(tei:p or tei:l)">true</xsl:when>
          <xsl:when test="self::tei:note[@place='display']">false</xsl:when>
          <xsl:when test="self::tei:note[tei:isEndNote(.)]">true</xsl:when>
          <xsl:when test="self::tei:note[tei:isFootNote(.)]">true</xsl:when>
          <xsl:when test="tei:match(@rend,'display') or tei:match(@rend,'block')">false</xsl:when>
          <xsl:when test="@type='display' or @type='block'">false</xsl:when>
          <xsl:when test="tei:table or tei:figure or tei:list or tei:lg    or tei:q/tei:l or tei:l or tei:p or tei:biblStruct or tei:sp or tei:floatingText">false</xsl:when>
          <xsl:when test="self::tei:cit[not(@rend)]">true</xsl:when>
          <xsl:when test="parent::tei:cit[tei:match(@rend,'display')]">false</xsl:when>
          <xsl:when test="parent::tei:cit and (tei:p or tei:l)">false</xsl:when>
          <xsl:when test="parent::tei:cit and parent::cit/tei:bibl">false</xsl:when>
          <xsl:when test="self::tei:docAuthor and parent::tei:byline">true</xsl:when>
          <xsl:when test="self::tei:note[tei:cit/tei:bibl]">false</xsl:when>
          <xsl:when test="self::tei:note[parent::tei:biblStruct]">true</xsl:when>
          <xsl:when test="self::tei:note[parent::tei:bibl]">true</xsl:when>
          <xsl:when test="self::tei:note">true</xsl:when>
          <xsl:when test="self::mml:math">true</xsl:when>
          <xsl:when test="self::tei:abbr">true</xsl:when>
          <xsl:when test="self::tei:affiliation">true</xsl:when>
          <xsl:when test="self::tei:altIdentifier">true</xsl:when>
          <xsl:when test="self::tei:analytic">true</xsl:when>
          <xsl:when test="self::tei:add">true</xsl:when>
          <xsl:when test="self::tei:am">true</xsl:when>
          <xsl:when test="self::tei:att">true</xsl:when>
          <xsl:when test="self::tei:author">true</xsl:when>
          <xsl:when test="self::tei:bibl and not (tei:isInline(preceding-sibling::*[1]))">false</xsl:when>
          <xsl:when test="self::tei:bibl and not (parent::tei:listBibl)">true</xsl:when>
          <xsl:when test="self::tei:biblScope">true</xsl:when>
          <xsl:when test="self::tei:br">true</xsl:when>
          <xsl:when test="self::tei:byline">true</xsl:when>
          <xsl:when test="self::tei:c">true</xsl:when>
          <xsl:when test="self::tei:caesura">true</xsl:when>
          <xsl:when test="self::tei:choice">true</xsl:when>
          <xsl:when test="self::tei:code">true</xsl:when>
          <xsl:when test="self::tei:collection">true</xsl:when>
          <xsl:when test="self::tei:country">true</xsl:when>
          <xsl:when test="self::tei:damage">true</xsl:when>
          <xsl:when test="self::tei:date">true</xsl:when>
          <xsl:when test="self::tei:del">true</xsl:when>
          <xsl:when test="self::tei:depth">true</xsl:when>
          <xsl:when test="self::tei:dim">true</xsl:when>
          <xsl:when test="self::tei:dimensions">true</xsl:when>
          <xsl:when test="self::tei:editor">true</xsl:when>
          <xsl:when test="self::tei:editionStmt">true</xsl:when>
          <xsl:when test="self::tei:emph">true</xsl:when>
          <xsl:when test="self::tei:ex">true</xsl:when>
          <xsl:when test="self::tei:expan">true</xsl:when>
          <xsl:when test="self::tei:figure[@place='inline']">true</xsl:when>
          <xsl:when test="self::tei:figure">false</xsl:when>
          <xsl:when test="self::tei:floatingText">false</xsl:when>
          <xsl:when test="self::tei:foreign">true</xsl:when>
          <xsl:when test="self::tei:forename">true</xsl:when>
          <xsl:when test="self::tei:g">true</xsl:when>
          <xsl:when test="self::tei:gap">true</xsl:when>
          <xsl:when test="self::tei:genName">true</xsl:when>
          <xsl:when test="self::tei:geogName">true</xsl:when>
          <xsl:when test="self::tei:gi">true</xsl:when>
          <xsl:when test="self::tei:gloss">true</xsl:when>
          <xsl:when test="self::tei:graphic">true</xsl:when>
          <xsl:when test="self::tei:media">true</xsl:when>
          <xsl:when test="self::tei:height">true</xsl:when>
          <xsl:when test="self::tei:hi[not(w:*)]">true</xsl:when>
          <xsl:when test="self::tei:ident">true</xsl:when>
          <xsl:when test="self::tei:idno">true</xsl:when>
          <xsl:when test="self::tei:imprint">true</xsl:when>
          <xsl:when test="self::tei:institution">true</xsl:when>
          <xsl:when test="self::tei:label[not(parent::tei:list)]">true</xsl:when>
          <xsl:when test="self::tei:locus">true</xsl:when>
          <xsl:when test="self::tei:mentioned">true</xsl:when>
          <xsl:when test="self::tei:monogr">true</xsl:when>
          <xsl:when test="self::tei:series">true</xsl:when>
          <xsl:when test="self::tei:msName">true</xsl:when>
          <xsl:when test="self::tei:name">true</xsl:when>
          <xsl:when test="self::tei:num">true</xsl:when>
          <xsl:when test="self::tei:orgName">true</xsl:when>
          <xsl:when test="self::tei:orig">true</xsl:when>
          <xsl:when test="self::tei:origDate">true</xsl:when>
          <xsl:when test="self::tei:origPlace">true</xsl:when>
          <xsl:when test="self::tei:pc">true</xsl:when>
          <xsl:when test="self::tei:persName">true</xsl:when>
          <xsl:when test="self::tei:placeName">true</xsl:when>
          <xsl:when test="self::tei:ptr">true</xsl:when>
          <xsl:when test="self::tei:publisher">true</xsl:when>
          <xsl:when test="self::tei:pubPlace">true</xsl:when>
          <xsl:when test="self::tei:lb or self::pb">true</xsl:when>
          <xsl:when test="self::tei:quote and tei:lb">false</xsl:when>
          <xsl:when test="self::tei:quote and $autoBlockQuote='true' and string-length(.)>$autoBlockQuoteLength">false</xsl:when>
          <xsl:when test="self::tei:q">true</xsl:when>
          <xsl:when test="self::tei:quote">true</xsl:when>
          <xsl:when test="self::tei:ref">true</xsl:when>
          <xsl:when test="self::tei:region">true</xsl:when>
          <xsl:when test="self::tei:repository">true</xsl:when>
          <xsl:when test="self::tei:roleName">true</xsl:when>
          <xsl:when test="self::tei:rubric">true</xsl:when>
          <xsl:when test="self::tei:rs">true</xsl:when>
          <xsl:when test="self::tei:said">true</xsl:when>
          <xsl:when test="self::tei:seg">true</xsl:when>
          <xsl:when test="self::tei:sic">true</xsl:when>
          <xsl:when test="self::tei:settlement">true</xsl:when>
          <xsl:when test="self::tei:soCalled">true</xsl:when>
          <xsl:when test="self::tei:summary">true</xsl:when>
          <xsl:when test="self::tei:supplied">true</xsl:when>
          <xsl:when test="self::tei:surname">true</xsl:when>
          <xsl:when test="self::tei:tag">true</xsl:when>
          <xsl:when test="self::tei:term">true</xsl:when>
          <xsl:when test="self::tei:textLang">true</xsl:when>
          <xsl:when test="self::tei:title">true</xsl:when>
          <xsl:when test="self::tei:unclear">true</xsl:when>
          <xsl:when test="self::tei:val">true</xsl:when>
          <xsl:when test="self::tei:width">true</xsl:when>
          <xsl:when test="self::tei:dynamicContent">true</xsl:when>
          <xsl:when test="self::w:drawing">true</xsl:when>
          <xsl:when test="self::m:oMath">true</xsl:when>
          <xsl:when test="parent::tei:note[tei:isEndNote(.)]">false</xsl:when>
          <xsl:when test="empty($element/..)">false</xsl:when>
          <xsl:when test="not(self::tei:p) and tei:isInline($element/..)">true</xsl:when>
          <xsl:otherwise>false</xsl:otherwise>
        </xsl:choose>
      </xsl:for-each>
    </xsl:otherwise>
  </xsl:choose>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:whatsTheDate ()
Documentation

Description

Returns the current date.
Namespace http://www.tei-c.org/ns/1.0
Import precedence 0
Source
<xsl:function name="tei:whatsTheDate">
  <xsl:value-of select="format-dateTime(current-dateTime(),'[Y]-[M02]-[D02]T[H02]:[m02]:[s02]Z')"/>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:isLast (element)
Documentation

Description

Whether an element has any more (useful) text in its parent
Namespace http://www.tei-c.org/ns/1.0
Type xs:boolean
Parameters
QName Namespace
element No namespace
Import precedence 0
Source
<xsl:function name="tei:isLast" as="xs:boolean">
  <xsl:param name="element"/>
  <xsl:for-each select="$element">
    <xsl:choose>
      <xsl:when test="count(following-sibling::node())=1 and normalize-space(following-sibling::node())=''">true</xsl:when>
      <xsl:when test="not(following-sibling::node())">true</xsl:when>
      <xsl:otherwise>false</xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:isFirst (element)
Documentation

Description

Whether an element has any (useful) text before it
Namespace http://www.tei-c.org/ns/1.0
Type xs:boolean
Parameters
QName Namespace
element No namespace
Import precedence 0
Source
<xsl:function name="tei:isFirst" as="xs:boolean">
  <xsl:param name="element"/>
  <xsl:for-each select="$element">
    <xsl:choose>
      <xsl:when test="count(preceding-sibling::node())=1 and normalize-space(preceding-sibling::node())=''">true</xsl:when>
      <xsl:when test="not(preceding-sibling::node())">true</xsl:when>
      <xsl:otherwise>false</xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:escapeChars (letters, context)
Documentation

Description

[common] allow for further handling of text. By default, just convert long s to short s, but some formats may escape some characters.
Namespace http://www.tei-c.org/ns/1.0
Type xs:string
Used by
Parameters
QName Namespace
context No namespace
letters No namespace
Import precedence 0
Source
<xsl:function name="tei:escapeChars" as="xs:string">
  <xsl:param name="letters"/>
  <xsl:param name="context"/>
  <xsl:value-of select="$letters"/>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:resolveURI (context, target)
Documentation

Description

[common] process target urls, looking for magic patterns
Namespace http://www.tei-c.org/ns/1.0
Type xs:string
References
Parameter
Parameters
QName Namespace
context No namespace
target No namespace
Import precedence 0
Source
<xsl:function name="tei:resolveURI" as="xs:string">
  <xsl:param name="context"/>
  <xsl:param name="target"/>
  <xsl:analyze-string select="normalize-space($target)" regex="^(\w+):(.+)$">
    <xsl:matching-substring>
      <xsl:variable name="prefix" select="regex-group(1)"/>
      <xsl:variable name="value" select="regex-group(2)"/>
      <xsl:choose>
        <xsl:when test="$context/ancestor::*/tei:teiHeader/tei:encodingDesc/tei:listPrefixDef/tei:prefixDef[@ident=$prefix]">
          <xsl:variable name="result">
            <xsl:for-each select="($context/ancestor::*/tei:teiHeader/tei:encodingDesc/tei:listPrefixDef/tei:prefixDef[@ident=$prefix])[1]">
              <xsl:sequence select="replace($value,@matchPattern,@replacementPattern)"/>
            </xsl:for-each>
          </xsl:variable>
          <xsl:choose>
            <xsl:when test="$result=''">
              <xsl:message terminate="yes">prefix pattern/replacement applied to
                <xsl:value-of select="$value"/>returns an empty result</xsl:message>
            </xsl:when>
            <xsl:otherwise>
              <xsl:sequence select="$result"/>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:when>
        <xsl:otherwise>
          <xsl:sequence select="."/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:matching-substring>
    <xsl:non-matching-substring>
      <xsl:variable name="base" select="$context/ancestor-or-self::*[@xml:base][1]/@xml:base"/>
      <xsl:sequence select="if (starts-with($base,'file:') or $ignoreXmlBase='true') then          $target else concat(replace($base,'/[^/]+$','/'),$target)"/>
    </xsl:non-matching-substring>
  </xsl:analyze-string>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:i18n (word)
Documentation

Description

[common] give language-specific version of a word or phrase

Parameters

word the word(s) to translate
Namespace http://www.tei-c.org/ns/1.0
Type xs:string
Used by
References
Template
Variable
Key
Parameter
Parameters
QName Namespace
word No namespace
Import precedence 0
Source
<xsl:function name="tei:i18n" as="xs:string">
  <xsl:param name="word"/>
  <xsl:variable name="Word">
    <xsl:value-of select="normalize-space($word)"/>
  </xsl:variable>
  <xsl:variable name="local">
    <xsl:call-template name="myi18n">
      <xsl:with-param name="word">
        <xsl:value-of select="$word"/>
      </xsl:with-param>
    </xsl:call-template>
  </xsl:variable>
  <xsl:choose>
    <xsl:when test="string-length($local)>0">
      <xsl:value-of select="$local"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:for-each select="$i18n">
        <xsl:choose>
          <xsl:when test="key('KEYS',$Word)/text[@xml:lang=$documentationLanguage]">
            <xsl:value-of select="key('KEYS',$Word)/text[@xml:lang=$documentationLanguage]"/>
          </xsl:when>
          <xsl:when test="key('KEYS',$Word)/text[@lang3=$documentationLanguage]">
            <xsl:value-of select="key('KEYS',$Word)/text[lang3=$documentationLanguage]"/>
          </xsl:when>
          <xsl:otherwise>
            <!--
		    <xsl:if test="$verbose='true'">
		    <xsl:message>NO TRANSLATION for <xsl:value-of 
		    select="$word"/> in <xsl:value-of select="$documentationLanguage"/></xsl:message>
		      </xsl:if>
		  -->
            <xsl:value-of select="key('KEYS',$Word)/text[@xml:lang='en']"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:for-each>
    </xsl:otherwise>
  </xsl:choose>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:generateTitle (context)
Documentation

Description

[common] Generate a title
Namespace http://www.tei-c.org/ns/1.0
Type node()*
References
Parameters
QName Namespace
context No namespace
Import precedence 0
Source
<xsl:function name="tei:generateTitle" as="node()*">
  <xsl:param name="context"/>
  <xsl:for-each select="$context">
    <xsl:choose>
      <xsl:when test="$useHeaderFrontMatter='true' and ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt">
        <xsl:apply-templates select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt"/>
      </xsl:when>
      <xsl:when test="ancestor-or-self::tei:TEI/tei:text/tei:front//tei:docTitle">
        <xsl:apply-templates select="ancestor-or-self::tei:TEI/tei:text/tei:front//tei:docTitle/tei:titlePart"/>
      </xsl:when>
      <xsl:when test="ancestor-or-self::tei:teiCorpus/tei:text/tei:front//tei:docTitle">
        <xsl:apply-templates select="ancestor-or-self::tei:teiCorpus/tei:text/tei:front//tei:docTitle/tei:titlePart"/>
      </xsl:when>
      <xsl:when test="ancestor-or-self::tei:teiCorpus">
        <xsl:apply-templates select="tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title[not(@type='subordinate')]"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:for-each select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt">
          <xsl:choose>
            <xsl:when test="tei:title[@type='main']">
              <xsl:apply-templates select="tei:title[@type='main']"/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:apply-templates select="tei:title"/>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:for-each>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:generateMetadataTitle (context)
Documentation

Description

[common] Generate a title for metadata context
Namespace http://www.tei-c.org/ns/1.0
Type node()*
Parameters
QName Namespace
context No namespace
Import precedence 0
Source
<xsl:function name="tei:generateMetadataTitle" as="node()*">
  <xsl:param name="context"/>
  <xsl:variable name="r">
    <xsl:for-each select="$context">
      <xsl:choose>
        <xsl:when test="ancestor-or-self::tei:teiCorpus">
          <xsl:apply-templates select="tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title[not(@type='subordinate')]"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:for-each select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt">
            <xsl:choose>
              <xsl:when test="tei:title[@type='main']">
                <xsl:apply-templates select="tei:title[@type='main']"/>
              </xsl:when>
              <xsl:otherwise>
                <xsl:apply-templates select="tei:title"/>
              </xsl:otherwise>
            </xsl:choose>
          </xsl:for-each>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:for-each>
  </xsl:variable>
  <xsl:value-of select="normalize-space($r)"/>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:generateEditor (context)
Documentation

Description

[common] Find a plausible editor name
Namespace http://www.tei-c.org/ns/1.0
Type node()*
References
Function
Parameters
QName Namespace
context No namespace
Import precedence 0
Source
<xsl:function name="tei:generateEditor" as="node()*">
  <xsl:param name="context"/>
  <xsl:for-each select="$context">
    <xsl:choose>
      <xsl:when test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:editor">
        <xsl:for-each select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:editor">
          <xsl:apply-templates/>
          <xsl:choose>
            <xsl:when test="count(following-sibling::tei:editor)=1">
              <xsl:if test="count(preceding-sibling::tei:editor)>=1">
                <xsl:text>, </xsl:text>
              </xsl:if>
              <xsl:sequence select="tei:i18n('and')"/>
            </xsl:when>
            <xsl:when test="following-sibling::tei:editor">,</xsl:when>
          </xsl:choose>
        </xsl:for-each>
      </xsl:when>
      <xsl:when test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/tei:change/tei:respStmt[tei:resp='editor']">
        <xsl:apply-templates select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/tei:change/tei:respStmt[tei:resp='editor'][1]/tei:name"/>
      </xsl:when>
    </xsl:choose>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:generateAuthor (context)
Documentation

Description

[common] Find a plausible main author name
Namespace http://www.tei-c.org/ns/1.0
Type node()*
References
Parameters
QName Namespace
context No namespace
Import precedence 0
Source
<xsl:function name="tei:generateAuthor" as="node()*">
  <xsl:param name="context"/>
  <xsl:variable name="result">
    <xsl:for-each select="$context">
      <xsl:choose>
        <xsl:when test="$useHeaderFrontMatter='true' and    ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:author">
          <xsl:apply-templates mode="author" select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:author"/>
        </xsl:when>
        <xsl:when test="ancestor-or-self::tei:TEI/tei:text/tei:front//tei:docAuthor">
          <xsl:apply-templates mode="author" select="ancestor-or-self::tei:TEI/tei:text/tei:front//tei:docAuthor"/>
        </xsl:when>
        <xsl:when test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:author">
          <xsl:apply-templates mode="author" select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:author"/>
        </xsl:when>
        <xsl:when test="ancestor-or-self::tei:teiCorpus/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:author">
          <xsl:apply-templates mode="author" select="ancestor-or-self::tei:teiCorpus/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:author"/>
        </xsl:when>
        <xsl:when test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/tei:change/tei:respStmt[tei:resp='author']">
          <xsl:apply-templates select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/tei:change/tei:respStmt[tei:resp='author'][1]/tei:name"/>
        </xsl:when>
      </xsl:choose>
    </xsl:for-each>
  </xsl:variable>
  <xsl:sequence select="$result"/>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:generateMetadataAuthor (context)
Documentation

Description

[common] Find a plausible main author name in metadata context
Namespace http://www.tei-c.org/ns/1.0
Type node()*
Parameters
QName Namespace
context No namespace
Import precedence 0
Source
<xsl:function name="tei:generateMetadataAuthor" as="node()*">
  <xsl:param name="context"/>
  <xsl:variable name="r">
    <xsl:for-each select="$context">
      <xsl:choose>
        <xsl:when test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:author">
          <xsl:apply-templates mode="author" select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:author"/>
        </xsl:when>
        <xsl:when test="ancestor-or-self::tei:teiCorpus/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:author">
          <xsl:apply-templates mode="author" select="ancestor-or-self::tei:teiCorpus/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:author"/>
        </xsl:when>
        <xsl:when test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/tei:change/tei:respStmt[tei:resp='author']">
          <xsl:apply-templates select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/tei:change/tei:respStmt[tei:resp='author'][1]/tei:name"/>
        </xsl:when>
      </xsl:choose>
    </xsl:for-each>
  </xsl:variable>
  <xsl:value-of select="normalize-space($r)"/>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:generateRevAuthor (context)
Documentation

Description

[common] Find a plausible name of person responsible for current revision
Namespace http://www.tei-c.org/ns/1.0
Type node()*
Parameters
QName Namespace
context No namespace
Import precedence 0
Source
<xsl:function name="tei:generateRevAuthor" as="node()*">
  <xsl:param name="context"/>
  <xsl:for-each select="$context">
    <xsl:variable name="who">
      <xsl:choose>
        <xsl:when test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/@vcwho">
          <xsl:apply-templates select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/@vcwho"/>
        </xsl:when>
        <xsl:when test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/tei:change[1]/tei:respStmt/tei:name">
          <xsl:value-of select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/tei:change[1]/tei:respStmt/tei:name/text()"/>
        </xsl:when>
      </xsl:choose>
    </xsl:variable>
    <xsl:choose>
      <xsl:when test="normalize-space($who)=concat('$Author', '$')"/>
      <xsl:when test="starts-with($who,'$Author')">
        <!-- it's RCS -->
        <xsl:value-of select="normalize-space(substring-before(substring-after($who,'Author'),'$'))"/>
      </xsl:when>
      <xsl:when test="starts-with($who,'$LastChangedBy')">
        <!-- it's Subversion -->
        <xsl:value-of select="normalize-space(substring-before(substring-after($who,'LastChangedBy:'),'$'))"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$who"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:generateRevDate (context)
Documentation

Description

[common] Work out the last revision date of the document
Namespace http://www.tei-c.org/ns/1.0
Type node()*
Parameters
QName Namespace
context No namespace
Import precedence 0
Source
<xsl:function name="tei:generateRevDate" as="node()*">
  <xsl:param name="context"/>
  <xsl:for-each select="$context">
    <xsl:variable name="when">
      <xsl:choose>
        <xsl:when test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/@vcdate">
          <xsl:apply-templates select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/@vcdate"/>
        </xsl:when>
        <xsl:when test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/descendant::tei:date">
          <xsl:value-of select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/descendant::tei:date[1]"/>
        </xsl:when>
        <xsl:when test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/descendant::tei:date">
          <xsl:value-of select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/descendant::tei:date"/>
        </xsl:when>
      </xsl:choose>
    </xsl:variable>
    <xsl:choose>
      <xsl:when test="starts-with($when,'$Date')">
        <!-- it's RCS -->
        <xsl:value-of select="substring($when,16,2)"/>
        <xsl:text>/</xsl:text>
        <xsl:value-of select="substring($when,13,2)"/>
        <xsl:text>/</xsl:text>
        <xsl:value-of select="substring($when,8,4)"/>
      </xsl:when>
      <xsl:when test="starts-with($when,'$LastChangedDate')">
        <!-- it's Subversion-->
        <xsl:value-of select="substring-before(substring-after($when,'('),')')"/>
      </xsl:when>
      <xsl:when test="not($when='')">
        <xsl:value-of select="$when"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="format-dateTime(current-dateTime(),'[Y]-[M02]-[D02]T[H02]:[m02]:[s02]Z')"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:checkNormalizedDate (context)
Documentation

Description

[common] Work out the publish date of the document
Namespace http://www.tei-c.org/ns/1.0
Used by
Parameters
QName Namespace
context No namespace
Import precedence 0
Source
<xsl:function name="tei:checkNormalizedDate">
  <xsl:param name="context"/>
  <xsl:value-of select="if ($context/@when) then $context/@when else $context"/>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:generateDate (context)
Namespace http://www.tei-c.org/ns/1.0
References
Parameters
QName Namespace
context No namespace
Import precedence 0
Source
<xsl:function name="tei:generateDate">
  <xsl:param name="context"/>
  <xsl:for-each select="$context">
    <xsl:choose>
      <xsl:when test="$useFixedDate='true'">1970-01-01</xsl:when>
      <xsl:when test="$useHeaderFrontMatter='true' and ancestor-or-self::tei:TEI/tei:text/tei:front//tei:docDate">
        <xsl:apply-templates mode="date" select="tei:checkNormalizedDate(ancestor-or-self::tei:TEI/tei:text/tei:front//tei:docDate)"/>
      </xsl:when>
      <xsl:when test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:editionStmt/descendant::tei:date">
        <xsl:value-of select="tei:checkNormalizedDate(ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:editionStmt/descendant::tei:date[1])"/>
      </xsl:when>
      <xsl:when test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:publicationStmt/tei:date">
        <xsl:value-of select="tei:checkNormalizedDate(ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:publicationStmt/tei:date)"/>
      </xsl:when>
      <xsl:when test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:editionStmt/tei:edition">
        <xsl:apply-templates select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:editionStmt/tei:edition"/>
      </xsl:when>
      <xsl:when test="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/tei:change[@when      or tei:date]">
        <xsl:for-each select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/tei:change[1]">
          <xsl:choose>
            <xsl:when test="@when">
              <xsl:value-of select="@when"/>
            </xsl:when>
            <xsl:when test="tei:date/@when">
              <xsl:value-of select="tei:date/@when"/>
            </xsl:when>
            <xsl:when test="tei:date">
              <xsl:value-of select="tei:date"/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="format-dateTime(current-dateTime(),'[Y]-[M02]-[D02]')"/>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:for-each>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="format-dateTime(current-dateTime(),'[Y]-[M02]-[D02]')"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:generateSimpleTitle (context)
Documentation

Description

[common]

Generate simple title with no markup

Namespace http://www.tei-c.org/ns/1.0
References
Parameters
QName Namespace
context No namespace
Import precedence 0
Source
<xsl:function name="tei:generateSimpleTitle">
  <xsl:param name="context"/>
  <xsl:for-each select="$context">
    <xsl:choose>
      <xsl:when test="$useHeaderFrontMatter='true' and ancestor-or-self::tei:TEI/tei:text/tei:front//tei:docTitle">
        <xsl:apply-templates select="ancestor-or-self::tei:TEI/tei:text/tei:front//tei:docTitle" mode="simple"/>
      </xsl:when>
      <xsl:when test="ancestor-or-self::tei:teiCorpus">
        <xsl:apply-templates select="ancestor-or-self::tei:teiCorpus/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title[not(@type='subordinate')]" mode="simple"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:for-each select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt">
          <xsl:choose>
            <xsl:when test="tei:title[@type='main']">
              <xsl:apply-templates select="tei:title[@type='main']" mode="simple"/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:apply-templates select="tei:title[1]" mode="simple"/>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:for-each>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:generateSubTitle (context)
Documentation

Description

[common] Generate subtitle
Namespace http://www.tei-c.org/ns/1.0
References
Parameters
QName Namespace
context No namespace
Import precedence 0
Source
<xsl:function name="tei:generateSubTitle">
  <xsl:param name="context"/>
  <xsl:for-each select="$context">
    <xsl:choose>
      <xsl:when test="$useHeaderFrontMatter='true' and ancestor-or-self::tei:TEI/tei:text/tei:front//tei:docTitle">
        <xsl:apply-templates select="ancestor-or-self::tei:TEI/tei:text/tei:front//tei:docTitle"/>
      </xsl:when>
      <xsl:when test="$useHeaderFrontMatter='true' and ancestor-or-self::tei:teiCorpus/tei:text/tei:front//tei:docTitle">
        <xsl:apply-templates select="ancestor-or-self::tei:teiCorpus/tei:text/tei:front//tei:docTitle"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:for-each select="ancestor-or-self::tei:TEI|ancestor-or-self::tei:teiCorpus">
          <xsl:apply-templates select="tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title[@type='subordinate']"/>
        </xsl:for-each>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:generateEdition (context)
Namespace http://www.tei-c.org/ns/1.0
Parameters
QName Namespace
context No namespace
Import precedence 0
Source
<xsl:function name="tei:generateEdition">
  <xsl:param name="context"/>
  <xsl:for-each select="$context">
    <xsl:value-of select="normalize-space(tei:TEI/tei:teiHeader/tei:fileDesc/tei:editionStmt/tei:edition)"/>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:generatePublisher (context, default)
Documentation

Description

[epub] Set name of publisher
Namespace http://www.tei-c.org/ns/1.0
Type node()*
Parameters
QName Namespace
context No namespace
default No namespace
Import precedence 0
Source
<xsl:function name="tei:generatePublisher" as="node()*">
  <xsl:param name="context"/>
  <xsl:param name="default"/>
  <xsl:for-each select="$context">
    <xsl:choose>
      <xsl:when test="not($default='')">
        <xsl:value-of select="$default"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:for-each select="/*/tei:teiHeader/tei:fileDesc/tei:publicationStmt">
          <xsl:for-each select="tei:authority|tei:publisher|tei:distributor|tei:p">
            <xsl:value-of select="normalize-space(.)"/>
            <xsl:if test="following-sibling::tei:authority|tei:publisher|tei:distributor|tei:p">
              <xsl:text>, </xsl:text>
            </xsl:if>
          </xsl:for-each>
        </xsl:for-each>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:isFootNote (context)
Documentation

Description

whether a note is a footnote
Namespace http://www.tei-c.org/ns/1.0
Type xs:boolean
Used by
Parameters
QName Namespace
context No namespace
Import precedence 0
Source
<xsl:function name="tei:isFootNote" as="xs:boolean">
  <xsl:param name="context"/>
  <xsl:for-each select="$context">
    <xsl:choose>
      <xsl:when test="ancestor::tei:listBibl">false</xsl:when>
      <xsl:when test="@place='foot'">true</xsl:when>
      <xsl:when test="@place='bottom'">true</xsl:when>
      <xsl:when test="@place='parend'">true</xsl:when>
      <xsl:when test="@place='tablefoot'">true</xsl:when>
      <xsl:otherwise>false</xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:isEndNote (context)
Documentation

Description

whether a note is an endnote
Namespace http://www.tei-c.org/ns/1.0
Type xs:boolean
Used by
Parameters
QName Namespace
context No namespace
Import precedence 0
Source
<xsl:function name="tei:isEndNote" as="xs:boolean">
  <xsl:param name="context"/>
  <xsl:for-each select="$context">
    <xsl:choose>
      <xsl:when test="@place='end'">true</xsl:when>
      <xsl:otherwise>false</xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:isOrderedList (context)
Documentation

Description

whether a list is to be rendered as ordered
Namespace http://www.tei-c.org/ns/1.0
Type xs:boolean
References
Parameters
QName Namespace
context No namespace
Import precedence 0
Source
<xsl:function name="tei:isOrderedList" as="xs:boolean">
  <xsl:param name="context"/>
  <xsl:for-each select="$context">
    <xsl:choose>
      <xsl:when test="tei:match(@rend,'numbered')">true</xsl:when>
      <xsl:when test="tei:match(@rend,'ordered')">true</xsl:when>
      <xsl:when test="@type='ordered'">true</xsl:when>
      <xsl:otherwise>false</xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:isUnorderedList (context)
Documentation

Description

whether a list is to be rendered as unordered
Namespace http://www.tei-c.org/ns/1.0
Type xs:boolean
References
Parameters
QName Namespace
context No namespace
Import precedence 0
Source
<xsl:function name="tei:isUnorderedList" as="xs:boolean">
  <xsl:param name="context"/>
  <xsl:for-each select="$context">
    <xsl:choose>
      <xsl:when test="not(@rend or @type)">true</xsl:when>
      <xsl:when test="tei:match(@rend,'unordered')">true</xsl:when>
      <xsl:when test="tei:match(@rend,'bulleted')">true</xsl:when>
      <xsl:when test="@type='unordered'">true</xsl:when>
      <xsl:otherwise>false</xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:isGlossList (context)
Documentation

Description

whether a list is to be rendered as a gloss list
Namespace http://www.tei-c.org/ns/1.0
Type xs:boolean
References
Parameters
QName Namespace
context No namespace
Import precedence 0
Source
<xsl:function name="tei:isGlossList" as="xs:boolean">
  <xsl:param name="context"/>
  <xsl:for-each select="$context">
    <xsl:choose>
      <xsl:when test="tei:match(@rend,'valList')">true</xsl:when>
      <xsl:when test="tei:match(@rend,'gloss')">true</xsl:when>
      <xsl:when test="@type='gloss'">true</xsl:when>
      <xsl:when test="tei:label">true</xsl:when>
      <xsl:otherwise>false</xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:isGlossTable (context)
Documentation

Description

whether a list is to be rendered as a gloss table
Namespace http://www.tei-c.org/ns/1.0
Type xs:boolean
References
Parameters
QName Namespace
context No namespace
Import precedence 0
Source
<xsl:function name="tei:isGlossTable" as="xs:boolean">
  <xsl:param name="context"/>
  <xsl:for-each select="$context">
    <xsl:choose>
      <xsl:when test="@type='valList'">true</xsl:when>
      <xsl:when test="tei:match(@rend,'glosstable')">true</xsl:when>
      <xsl:when test="@type='glosstable'">true</xsl:when>
      <xsl:otherwise>false</xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:isInlineList (context)
Documentation

Description

whether a list is to be rendered inline
Namespace http://www.tei-c.org/ns/1.0
Type xs:boolean
References
Parameters
QName Namespace
context No namespace
Import precedence 0
Source
<xsl:function name="tei:isInlineList" as="xs:boolean">
  <xsl:param name="context"/>
  <xsl:for-each select="$context">
    <xsl:choose>
      <xsl:when test="tei:match(@rend,'inline')">true</xsl:when>
      <xsl:when test="@type='inline'">true</xsl:when>
      <xsl:when test="ancestor::tei:head or parent::tei:label">true</xsl:when>
      <xsl:otherwise>false</xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:makeDescription (context, showListRef)
Documentation

Description

extract description for an ODD
Namespace http://www.tei-c.org/ns/1.0
Type node()*
References
Parameters
QName Namespace
context No namespace
showListRef No namespace
Import precedence 0
Source
<xsl:function name="tei:makeDescription" as="node()*">
  <xsl:param name="context"/>
  <xsl:param name="showListRef"/>
  <xsl:variable name="D">
    <xsl:for-each select="$context">
      <xsl:variable name="langs" select="tei:generateDocumentationLang(.)"/>
      <xsl:variable name="firstLang" select="($langs)[1]"/>
      <!-- first the gloss -->
      <xsl:sequence select="tei:makeGloss(.,$langs)"/>
      <!-- now the description -->
      <xsl:choose>
        <xsl:when test="not(tei:desc)">
        </xsl:when>
        <xsl:when test="count(tei:desc)=1">
          <xsl:for-each select="tei:desc">
            <xsl:apply-templates select="." mode="inLanguage"/>
          </xsl:for-each>
        </xsl:when>
        <xsl:when test="tei:desc[@xml:lang=$firstLang]">
          <xsl:for-each select="tei:desc[@xml:lang=$firstLang]">
            <xsl:apply-templates select="." mode="inLanguage"/>
          </xsl:for-each>
        </xsl:when>
        <xsl:otherwise>
          <xsl:variable name="D">
            <xsl:for-each select="tei:desc">
              <xsl:variable name="currentLang" select="tei:findLanguage(.)"/>
              <xsl:if test="$currentLang=($langs)">
                <xsl:apply-templates select="." mode="inLanguage"/>
              </xsl:if>
            </xsl:for-each>
          </xsl:variable>
          <xsl:choose>
            <xsl:when test="$D='' and tei:desc[(not(@xml:lang) or @xml:lang='en')]">
              <xsl:for-each select="tei:desc[(not(@xml:lang) or @xml:lang='en')]">
                <xsl:apply-templates select="." mode="inLanguage"/>
              </xsl:for-each>
            </xsl:when>
            <xsl:when test="not($oddmode='tei')">
              <xsl:sequence select="$D/text()"/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:copy-of select="$D"/>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:otherwise>
      </xsl:choose>
      <xsl:choose>
        <xsl:when test="$oddmode='tei'"/>
        <xsl:when test="tei:valList[@type='open']">
          <xsl:text>
</xsl:text>
          <xsl:sequence select="tei:i18n('Sample values include')"/>
          <xsl:text>: </xsl:text>
          <xsl:for-each select="tei:valList/tei:valItem">
            <xsl:number/>
            <xsl:text>] </xsl:text>
            <xsl:choose>
              <xsl:when test="tei:altIdent=@ident">
                <xsl:value-of select="@ident"/>
              </xsl:when>
              <xsl:when test="tei:altIdent">
                <xsl:value-of select="normalize-space(tei:altIdent)"/>
              </xsl:when>
              <xsl:otherwise>
                <xsl:value-of select="@ident"/>
              </xsl:otherwise>
            </xsl:choose>
            <xsl:variable name="langs">
              <xsl:value-of select="concat(normalize-space(tei:generateDocumentationLang(.)),' ')"/>
            </xsl:variable>
            <xsl:variable name="firstLang" select="($langs)[1]"/>
            <xsl:sequence select="tei:makeGloss(.,$langs)"/>
            <xsl:if test="following-sibling::tei:valItem">
              <xsl:text>; </xsl:text>
            </xsl:if>
          </xsl:for-each>
        </xsl:when>
        <xsl:when test="tei:valList[@type='semi']">
          <xsl:text>
</xsl:text>
          <xsl:sequence select="tei:i18n('Suggested values include')"/>
          <xsl:text>: </xsl:text>
          <xsl:for-each select="tei:valList/tei:valItem">
            <xsl:number/>
            <xsl:text>] </xsl:text>
            <xsl:choose>
              <xsl:when test="tei:altIdent=@ident">
                <xsl:value-of select="@ident"/>
              </xsl:when>
              <xsl:when test="tei:altIdent">
                <xsl:value-of select="normalize-space(tei:altIdent)"/>
              </xsl:when>
              <xsl:otherwise>
                <xsl:value-of select="@ident"/>
              </xsl:otherwise>
            </xsl:choose>
            <xsl:variable name="langs">
              <xsl:value-of select="concat(normalize-space(tei:generateDocumentationLang(.)),' ')"/>
            </xsl:variable>
            <xsl:variable name="firstLang" select="($langs)[1]"/>
            <xsl:sequence select="tei:makeGloss(.,$langs)"/>
            <xsl:if test="following-sibling::tei:valItem">
              <xsl:text>; </xsl:text>
            </xsl:if>
          </xsl:for-each>
        </xsl:when>
      </xsl:choose>
      <xsl:if test="tei:listRef and $showListRef">
        <xsl:text> [</xsl:text>
        <xsl:for-each select="tei:listRef/tei:*">
          <xsl:apply-templates select="." mode="weave"/>
          <xsl:if test="following-sibling::tei:*">
            <xsl:text> </xsl:text>
          </xsl:if>
        </xsl:for-each>
        <xsl:text>]</xsl:text>
      </xsl:if>
    </xsl:for-each>
  </xsl:variable>
  <xsl:copy-of select="$D"/>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:generateDocumentationLang (context)
Documentation

Description

[localisation]work out the language for documentation
Namespace http://www.tei-c.org/ns/1.0
Type node()*
Used by
References
Variable
Key
Parameter
Parameters
QName Namespace
context No namespace
Import precedence 0
Source
<xsl:function name="tei:generateDocumentationLang" as="node()*">
  <xsl:param name="context"/>
  <xsl:for-each select="$context">
    <xsl:choose>
      <xsl:when test="key('LISTSCHEMASPECS',$whichSchemaSpec)/@docLang">
        <xsl:value-of select="key('LISTSCHEMASPECS',$whichSchemaSpec)/@docLang"/>
      </xsl:when>
      <xsl:when test="string-length($doclang)>0">
        <xsl:value-of select="$doclang"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:text>en</xsl:text>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:makeGloss (context, langs)
Documentation

Description

work out which <gloss> to use
Namespace http://www.tei-c.org/ns/1.0
Type node()*
Used by
References
Parameters
QName Namespace
context No namespace
langs No namespace
Import precedence 0
Source
<xsl:function name="tei:makeGloss" as="node()*">
  <xsl:param name="context"/>
  <xsl:param name="langs"/>
  <xsl:variable name="firstLang" select="($langs)[1]"/>
  <xsl:for-each select="$context">
    <xsl:choose>
      <xsl:when test="not(tei:gloss)"/>
      <xsl:when test="string-length(tei:gloss[1])=0"/>
      <xsl:when test="count(tei:gloss)=1 and not(tei:gloss[@xml:lang])">
        <xsl:text>(</xsl:text>
        <xsl:apply-templates select="tei:gloss" mode="inLanguage"/>
        <xsl:text>) </xsl:text>
      </xsl:when>
      <xsl:when test="tei:gloss[@xml:lang=$firstLang]">
        <xsl:if test="not(tei:gloss[@xml:lang=$firstLang]='')">
          <xsl:text>(</xsl:text>
          <xsl:apply-templates select="tei:gloss[@xml:lang=$firstLang]" mode="inLanguage"/>
          <xsl:text>) </xsl:text>
        </xsl:if>
      </xsl:when>
      <xsl:otherwise>
        <xsl:variable name="G">
          <xsl:for-each select="tei:gloss">
            <xsl:variable name="currentLang" select="tei:findLanguage(.)"/>
            <xsl:if test="$currentLang=($langs)">
              <xsl:text>(</xsl:text>
              <xsl:apply-templates select="." mode="inLanguage"/>
              <xsl:text>) </xsl:text>
            </xsl:if>
          </xsl:for-each>
        </xsl:variable>
        <xsl:choose>
          <xsl:when test="$G='' and tei:gloss[(not(@xml:lang) or @xml:lang='en')]">
            <xsl:text>(</xsl:text>
            <xsl:apply-templates select="tei:gloss[(not(@xml:lang) or @xml:lang='en')]" mode="inLanguage"/>
            <xsl:text>) </xsl:text>
          </xsl:when>
          <xsl:otherwise>
            <xsl:copy-of select="$G"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:generate-nsprefix-schematron (e)
Documentation

Description

which prefix for schematron
Namespace http://www.tei-c.org/ns/1.0
Type xs:string
Parameters
QName Namespace
e No namespace
Import precedence 0
Source
<xsl:function name="tei:generate-nsprefix-schematron" as="xs:string">
  <xsl:param name="e"/>
  <xsl:for-each select="$e">
    <xsl:variable name="myns" select="ancestor::tei:elementSpec/@ns"/>
    <xsl:choose>
      <xsl:when test="not($myns) or $myns='http://www.tei-c.org/ns/1.0'">
        <xsl:text>tei:</xsl:text>
      </xsl:when>
      <xsl:otherwise>
        <xsl:choose>
          <xsl:when test="ancestor::tei:schemaSpec//sch:ns[@uri=$myns]">
            <xsl:value-of select="concat(ancestor::tei:schemaSpec//sch:ns[@uri=$myns]/@prefix,':')"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:message terminate="yes">schematron rule cannot work out prefix for
              <xsl:value-of select="ancestor::tei:elementSpec/@ident"/>
            </xsl:message>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:stylesheetVersion (context)
Documentation

Description

find version of stylesheets
Namespace http://www.tei-c.org/ns/1.0
Type xs:string
References
Parameter
Parameters
QName Namespace
context No namespace
Import precedence 0
Source
<xsl:function name="tei:stylesheetVersion" as="xs:string">
  <xsl:param name="context"/>
  <xsl:choose>
    <xsl:when test="$useFixedDate='true'">0</xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="unparsed-text('../VERSION')"/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:getWitness (witness)
Documentation

Description

look up witness
Namespace http://www.tei-c.org/ns/1.0
Type xs:string*
References
Variable
Parameters
QName Namespace
witness No namespace
Import precedence 0
Source
<xsl:function name="tei:getWitness" as="xs:string*">
  <xsl:param name="witness"/>
  <xsl:variable name="r">
    <xsl:for-each select="tokenize($witness,' ')">
      <xsl:variable name="wit" select="."/>
      <xsl:for-each select="$top">
        <xsl:choose>
          <xsl:when test="starts-with($wit,'#') and      id(substring($wit,2))">
            <xsl:for-each select="id(substring($wit,2))">
              <xsl:value-of select="if (@n) then @n else @xml:id"/>
            </xsl:for-each>
          </xsl:when>
          <xsl:when test="starts-with($wit,'#')">
            <xsl:value-of select="substring($wit,2)"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:for-each select="doc($wit)/*">
              <xsl:value-of select="if (@n) then @n else @xml:id"/>
            </xsl:for-each>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:for-each>
      <xsl:if test="position() < last()">,</xsl:if>
    </xsl:for-each>
  </xsl:variable>
  <xsl:value-of select="$r"/>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:createSpecName (context)
Namespace http://www.tei-c.org/ns/1.0
Type xs:string
Parameters
QName Namespace
context No namespace
Import precedence 0
Source
<xsl:function name="tei:createSpecName" as="xs:string">
  <xsl:param name="context"/>
  <xsl:for-each select="$context">
    <xsl:value-of select="if (tei:altIdent) then          normalize-space(tei:altIdent) else @ident"/>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:createSpecPrefix (context)
Documentation

Description

 work out a name prefix for ODD objects 
Namespace http://www.tei-c.org/ns/1.0
Type xs:string
References
Parameters
QName Namespace
context No namespace
Import precedence 0
Source
<xsl:function name="tei:createSpecPrefix" as="xs:string">
  <xsl:param name="context"/>
  <xsl:variable name="result">
    <xsl:for-each select="$context">
      <xsl:variable name="ns" select="ancestor-or-self::*[@ns][1]/@ns"/>
      <xsl:choose>
        <xsl:when test="@prefix">
          <xsl:value-of select="@prefix"/>
        </xsl:when>
        <xsl:when test="not($ns) or $ns='http://www.tei-c.org/ns/1.0'"/>
        <xsl:when test="$ns='http://www.w3.org/XML/1998/namespace'">
          <xsl:text>xml:</xsl:text>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="translate(tei:getPrefix($ns,.),':','_')"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:for-each>
  </xsl:variable>
  <xsl:value-of select="$result"/>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:getPrefix (ns, here)
Namespace http://www.tei-c.org/ns/1.0
Type xs:string*
Used by
Parameters
QName Namespace
here No namespace
ns No namespace
Import precedence 0
Source
<xsl:function name="tei:getPrefix" as="xs:string*">
  <xsl:param name="ns"/>
  <xsl:param name="here"/>
  <xsl:for-each select="in-scope-prefixes($here)">
    <xsl:choose>
      <xsl:when test=".=''"/>
      <xsl:when test="$ns=namespace-uri-for-prefix(.,$here)">
        <xsl:value-of select="concat(.,':')"/>
      </xsl:when>
    </xsl:choose>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:makePatternID (context)
Documentation

Description

work out unique ID for generated Schematron
Namespace http://www.tei-c.org/ns/1.0
Type xs:string
Parameters
QName Namespace
context No namespace
Import precedence 0
Source
<xsl:function name="tei:makePatternID" as="xs:string">
  <xsl:param name="context"/>
  <xsl:for-each select="$context">
    <xsl:variable name="num">
      <xsl:number level="any"/>
    </xsl:variable>
    <xsl:value-of select="(../ancestor::*[@ident]/@ident,'constraint',../@ident,$num)" separator="-"/>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:findLanguage (context)
Documentation

Description

find nearest language code
Namespace http://www.tei-c.org/ns/1.0
Used by
Parameters
QName Namespace
context No namespace
Import precedence 0
Source
<xsl:function name="tei:findLanguage">
  <xsl:param name="context"/>
  <!-- note: $context should always be 1 node, so following -->
  <!-- for-each just sets context node and executes once for it -->
  <xsl:for-each select="$context">
    <xsl:value-of select="(ancestor-or-self::*[@xml:lang][1]/@xml:lang/string(),'en')[1]"/>
    <!-- 
           That XPath is a bit complex, so deserves some explanation.
           ( = start a (two item) sequence
           ancestor-or-self::tei:* = generate sequence of elements starting from the context
                                     node selecting each parent:: until the outermost element
           [@xml:lang] = filter the selected set to only those that have @xml:lang; note that
                         the sequence is still in closest to root order
           [1] = take only the first, i.e. closest, of those nodes
           /@xml:lang = take its @xml:lang attribute
           /string() = convert that attribute to a string
           , = separate the two items in our sequence; note that what's on the L will be
               either a single @xml:lang value or nothing
           'en' = second item in our two item sequence
           ) = end the (two item) sequence
           [1] = select the first item in the sequence: if the first item is nothing, it is
                 really a one item sequence, we get the 'en'; if the first item is a string
                 we get it.
         -->
  </xsl:for-each>
  <!-- Syd Bauman scripsit-->
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:sanitize (text)
Documentation

Description

pare back a string to contain only alphanumerics and some punctuation
Namespace http://www.tei-c.org/ns/1.0
Type xs:string
Parameters
QName Namespace
text No namespace
Import precedence 0
Source
<xsl:function name="tei:sanitize" as="xs:string">
  <xsl:param name="text"/>
  <xsl:variable name="alltext">
    <xsl:value-of select="($text)" separator=""/>
  </xsl:variable>
  <xsl:variable name="result" select="replace(normalize-space($alltext),'[^\w\[\]\\(\)._\s]+','')"/>
  <xsl:value-of select="if (string-length($result)>127) then   concat(substring($result,1,127),'...') else $result"/>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:generateMimeType (filename, type)
Documentation

Description

map file suffix to mime type
Namespace http://www.tei-c.org/ns/1.0
Type xs:string
Parameters
QName Namespace
filename No namespace
type No namespace
Import precedence 0
Source
<xsl:function name="tei:generateMimeType" as="xs:string">
  <xsl:param name="filename"/>
  <xsl:param name="type"/>
  <xsl:variable name="filesuffix" select="lower-case(tokenize($filename,'\.')[last()])"/>
  <xsl:choose>
    <xsl:when test="$type">
      <xsl:message>check
        <xsl:value-of select="($filename,$filesuffix,$type)"/>
      </xsl:message>
      <xsl:value-of select="$type"/>
    </xsl:when>
    <xsl:when test="$filesuffix='bin'">application/vnd.openxmlformats-officedocument.oleObject</xsl:when>
    <xsl:when test="$filesuffix='emf'">image/x-emf</xsl:when>
    <xsl:when test="$filesuffix='gif'">image/gif</xsl:when>
    <xsl:when test="$filesuffix='m4v'">video/mpeg4</xsl:when>
    <xsl:when test="$filesuffix='mp4'">video/mpeg4</xsl:when>
    <xsl:when test="$filesuffix='mpeg'">video/mpeg4</xsl:when>
    <xsl:when test="$filesuffix='png'">image/png</xsl:when>
    <xsl:when test="$filesuffix='tif'">image/tiff</xsl:when>
    <xsl:when test="$filesuffix='tiff'">image/tiff</xsl:when>
    <xsl:when test="$filesuffix='wav'">audio/wav</xsl:when>
    <xsl:when test="$filesuffix='ogg'">audio/ogg</xsl:when>
    <xsl:when test="$filesuffix='mp3'">audio/mpeg</xsl:when>
    <xsl:when test="$filesuffix='wmf'">image/x-wmf</xsl:when>
    <xsl:otherwise>image/jpeg</xsl:otherwise>
  </xsl:choose>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:isMarginal (place)
Namespace http://www.tei-c.org/ns/1.0
Type xs:boolean
Parameters
QName Namespace
place No namespace
Import precedence 0
Source
<xsl:function name="tei:isMarginal" as="xs:boolean">
  <xsl:param name="place"/>
  <xsl:choose>
    <xsl:when test="tokenize($place,' ')=('margin',          'margin/inline',         'marg1',         'marg2',         'marg3',         'marge',         'h',         'inter',         'right',         'left',         'divend',         'marginOuter',         'marginLeft',         'marginRight',         'margin-left',         'margin-right',         'margin_left',         'margin_right',         'margin-top',         'margin-bottom',         'top','opposite',         'overleaf',         'inspace')">true</xsl:when>
    <xsl:otherwise>false</xsl:otherwise>
  </xsl:choose>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Function tei:match (att, value)
Namespace http://www.tei-c.org/ns/1.0
Type xs:boolean
Used by
Parameters
QName Namespace
att No namespace
value No namespace
Import precedence 0
Source
<xsl:function name="tei:match" as="xs:boolean">
  <xsl:param name="att"/>
  <xsl:param name="value"/>
  <xsl:sequence select="if (tokenize($att,' ')=($value)) then true()       else false()"/>
</xsl:function>
Stylesheet location ../../../common/functions.xsl
Key LISTSCHEMASPECS
Namespace No namespace
Match tei:schemaSpec
Use @ident
Used by
Source
<xsl:key match="tei:schemaSpec" name="LISTSCHEMASPECS" use="@ident"/>
Stylesheet location ../../../common/functions.xsl
Key SCHEMASPECS
Namespace No namespace
Match tei:schemaSpec
Use 1
Used by
Variable
Source
<xsl:key match="tei:schemaSpec" name="SCHEMASPECS" use="1"/>
Stylesheet location ../../../common/functions.xsl
Key KEYS
Namespace No namespace
Match entry
Use key
Used by
Function
Source
<xsl:key match="entry" name="KEYS" use="key"/>
Stylesheet location ../../../common/functions.xsl