TEI stylesheet dealing with elements from the core module, making
HTML output.
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.
<xsl:template match="tei:hi"><xsl:variable name="rend"><x><xsl:call-template name="makeRendition"/></x></xsl:variable><xsl:variable name="container" select="if (tei:render-superscript(.)) then 'sup' else if (tei:render-subscript(.)) then 'sub' else if (tei:match(@rend,'code')) then 'code' else 'span'"/><xsl:for-each-group select="*|text()" group-adjacent="if (self::tei:note or self::tei:q/tei:l or self::tei:q/tei:p or self::tei:table or self::tei:list or self::tei:figure) then 1 else 2"><xsl:choose><xsl:when test="current-grouping-key()=1"><xsl:apply-templates select="current-group()"/></xsl:when><xsl:otherwise><xsl:element name="{$container}"><xsl:copy-of select="$rend/*/@*"/><xsl:apply-templates select="current-group()"/></xsl:element><!-- ***<xsl:value-of select="current-group()"/>*** --></xsl:otherwise></xsl:choose></xsl:for-each-group></xsl:template>
<xsl:template name="marginalNote"><xsl:variable name="identifier"><xsl:call-template name="noteID"/></xsl:variable><xsl:choose><xsl:when test="@type='milestone'"><span class="{if (@place) then if (contains(@place,'right')) then 'notemarginRight' else 'notemarginLeft' else 'notemarginLeft'}"><xsl:call-template name="makeAnchor"><xsl:with-param name="name" select="$identifier"/></xsl:call-template><xsl:apply-templates/></span></xsl:when><xsl:when test="parent::tei:item or parent::tei:cell or parent::tei:salute or parent::tei:head/parent::tei:list or parent::tei:q/parent::tei:div or parent::tei:div or parent::tei:l or parent::tei:bibl/parent::tei:q/parent::tei:epigraph or parent::tei:bibl/parent::tei:q/parent::tei:p "><div class="{if (@place) then if (contains(@place,'right')) then 'notemarginRight' else 'notemarginLeft' else 'notemarginLeft'}"><xsl:call-template name="makeAnchor"><xsl:with-param name="name" select="$identifier"/></xsl:call-template><xsl:apply-templates/></div></xsl:when><xsl:when test="not(parent::tei:p or parent::tei:head)"><span class="{if (@place) then if (contains(@place,'right')) then 'notemarginRight' else 'notemarginLeft' else 'notemarginLeft'}"><xsl:call-template name="makeAnchor"><xsl:with-param name="name" select="$identifier"/></xsl:call-template><xsl:apply-templates/></span></xsl:when><xsl:when test="@place='margin' and parent::tei:hi and not(*)"><aside class="note{@place}"><xsl:call-template name="makeAnchor"><xsl:with-param name="name" select="$identifier"/></xsl:call-template><xsl:apply-templates/></aside></xsl:when><xsl:when test="*[not(tei:isInline(.))]"><aside class="note{@place}"><xsl:call-template name="makeAnchor"><xsl:with-param name="name" select="$identifier"/></xsl:call-template><xsl:apply-templates/></aside></xsl:when><xsl:when test="tokenize(@place,' ')=('margin','marginRight','margin-right','margin_right')"><aside class="notemarginRight"><xsl:call-template name="makeAnchor"><xsl:with-param name="name" select="$identifier"/></xsl:call-template><xsl:apply-templates/></aside></xsl:when><xsl:when test="tokenize(@place,' ')=('margin','marginLeft','margin-left','margin_left')"><aside class="notemarginLeft"><xsl:call-template name="makeAnchor"><xsl:with-param name="name" select="$identifier"/></xsl:call-template><xsl:apply-templates/></aside></xsl:when><xsl:otherwise><aside class="notemarginLeft {@place}"><xsl:call-template name="makeAnchor"><xsl:with-param name="name" select="$identifier"/></xsl:call-template><xsl:apply-templates/></aside></xsl:otherwise></xsl:choose></xsl:template>
<xsl:template match="tei:note" mode="printnotes"><xsl:param name="whence" select="."/><xsl:choose><xsl:when test="ancestor::tei:listBibl"/><xsl:when test="ancestor::tei:floatingText"/><xsl:when test="number($splitLevel)=-1"/><xsl:when test="tei:isEndNote(.) or tei:isFootNote(.) or $autoEndNotes='true'"><xsl:variable name="parent"><xsl:for-each select="ancestor::tei:*[local-name()='div' or local-name()='div1' or local-name()='div2' or local-name()='div3' or local-name()='div4' or local-name()='div5' or local-name()='div6'][1]"><xsl:call-template name="locateParentDiv"/></xsl:for-each></xsl:variable><xsl:if test="$whence = $parent"><xsl:call-template name="makeaNote"/></xsl:if></xsl:when></xsl:choose></xsl:template>
<xsl:template match="tei:q|tei:said"><xsl:choose><xsl:when test="count(*)=1 and tei:floatingText"><xsl:apply-templates/></xsl:when><xsl:when test="(not(parent::tei:p/text()) and count(parent::tei:p/*)=1) or tei:floatingText or not(tei:isInline(.))"><div><xsl:call-template name="makeRendition"><xsl:with-param name="auto">blockquote</xsl:with-param></xsl:call-template><xsl:apply-templates/></div></xsl:when><xsl:otherwise><span><xsl:call-template name="makeRendition"/><xsl:call-template name="makeQuote"/></span></xsl:otherwise></xsl:choose></xsl:template>
<xsl:template match="tei:soCalled"><xsl:choose><xsl:when test="@rend or @rendition or @style"><span><xsl:call-template name="makeRendition"/><xsl:apply-templates/></span></xsl:when><xsl:otherwise><xsl:value-of select="$preQuote"/><xsl:apply-templates/><xsl:value-of select="$postQuote"/></xsl:otherwise></xsl:choose></xsl:template>