Skip to content
Permalink
6292d2029d
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
873 lines (814 sloc) 29.3 KB
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:tei="http://www.tei-c.org/ns/1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:eoa="http://www.edition-open-access.de/ns"
exclude-result-prefixes="xs tei"
version="2.0">
<xsl:template match="tei:body//tei:div[@type = ('chapter', 'chapteroriginal', 'chaptertranslation')]">
<xsl:value-of select="eoa:texcomment('A subordinate file.')" />
<xsl:choose>
<xsl:when test="self::tei:div[@type='chapteroriginal']">
<xsl:text>\vspace{-2\baselineskip}</xsl:text>
<xsl:text>\noindent\EOAemph{Traduzione italiana a p.~\EOApageref{</xsl:text>
<xsl:value-of select="substring-after(@corresp, '#')"/>
<xsl:text>}.}</xsl:text>
<xsl:text>\vspace{2\baselineskip}&#x000a;&#x000a;</xsl:text>
</xsl:when>
<xsl:when test="self::tei:div[@type='chaptertranslation']">
<xsl:text>\vspace{-2\baselineskip}</xsl:text>
<xsl:text>\noindent\EOAemph{Versione originale latina a p.~\EOApageref{</xsl:text>
<xsl:value-of select="substring-after(@corresp, '#')"/>
<xsl:text>}.}</xsl:text>
<xsl:text>\vspace{2\baselineskip}&#x000a;&#x000a;</xsl:text>
</xsl:when>
</xsl:choose>
<xsl:apply-templates select="*[not(self::tei:head)] | processing-instruction()"/>
</xsl:template>
<xsl:template match="tei:div[@type = ('section', 'subsection', 'subsubsection')]">
<!--
<xsl:template match="tei:div[not(@type = ('chapter', 'indexchapter', 'part', 'chapteroriginal'))]">
-->
<xsl:call-template name="begin_paragraph"/>
<xsl:choose>
<xsl:when test="@type='section'">
<xsl:sequence select="eoa:debug(0, 'section: ', @n)"/>
<xsl:text>\EOAsection</xsl:text>
</xsl:when>
<xsl:when test="@type='subsection'">
<xsl:sequence select="eoa:debug(0, 'subsection: ', @n)"/>
<xsl:text>\EOAsubsection</xsl:text>
</xsl:when>
<xsl:when test="@type='subsubsection'">
<xsl:sequence select="eoa:debug(0, 'subsubsection: ', @n)"/>
<xsl:text>\EOAsubsubsection</xsl:text>
</xsl:when>
</xsl:choose>
<xsl:if test="@n='nonumber'">
<xsl:text>nonumber</xsl:text>
</xsl:if>
<xsl:text>{</xsl:text>
<xsl:apply-templates select="tei:head"/>
<xsl:text>}</xsl:text>
<xsl:choose>
<xsl:when test="not(@xml:id)">
<xsl:variable name="current_el" as="xs:string"><xsl:call-template name="print_el_with_ctxt"/></xsl:variable>
<xsl:value-of select="eoa:debug(2, 'No ID for section: ', $current_el)" />
</xsl:when>
<xsl:otherwise>
<xsl:text>\EOAlabel{</xsl:text>
<xsl:value-of select="@xml:id"/>
<xsl:text>}</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>&#x000a;</xsl:text>
<xsl:apply-templates select="tei:*[not(self::tei:head)] | processing-instruction()"/>
</xsl:template>
<xsl:template match="tei:body//tei:quote">
<xsl:call-template name="begin_paragraph"/>
<xsl:text>\begin{EOAquote}</xsl:text>
<xsl:text>&#x000a;</xsl:text>
<xsl:apply-templates/>
<xsl:text>&#x000a;</xsl:text>
<xsl:text>\end{EOAquote}</xsl:text>
<xsl:text>&#x000a;</xsl:text>
</xsl:template>
<xsl:template match="tei:body//tei:ab[@type='chapterabstract']">
<xsl:call-template name="begin_paragraph"/>
<xsl:text>\begin{EOAabstract}</xsl:text>
<xsl:apply-templates/>
<xsl:text>\end{EOAabstract}</xsl:text>
<xsl:text>&#x000a;</xsl:text>
</xsl:template>
<xsl:template match="tei:body//tei:ab[@type='theoremdeclaration']">
<xsl:call-template name="begin_paragraph"/>
<xsl:text>\EOAnewtheorem</xsl:text>
<xsl:text>{</xsl:text>
<xsl:value-of select="@xml:id"/>
<xsl:text>}</xsl:text>
<xsl:text>{</xsl:text>
<xsl:apply-templates/>
<xsl:text>}</xsl:text>
<xsl:text>&#x000a;</xsl:text>
</xsl:template>
<xsl:template match="tei:body//tei:ab[@type='theoreminstance']">
<xsl:variable name="theorem_name" as="xs:string" select="if (not(contains(@corresp, '#'))) then (@corresp) else (substring-after(@corresp, '#'))"/>
<xsl:call-template name="begin_paragraph"/>
<xsl:text>\begin{</xsl:text>
<xsl:value-of select="$theorem_name"/>
<xsl:text>}&#x000a;</xsl:text>
<xsl:apply-templates/>
<xsl:text>&#x000a;\end{</xsl:text>
<xsl:value-of select="$theorem_name"/>
<xsl:text>}</xsl:text>
<xsl:text>&#x000a;</xsl:text>
</xsl:template>
<xsl:template match="tei:body//tei:ab[@type='equation']">
<xsl:call-template name="begin_paragraph"/>
<xsl:text>\begin{EOAequation</xsl:text>
<xsl:choose>
<xsl:when test="@n='nonumber'">
<xsl:text>nonumber}</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>}{</xsl:text>
<xsl:value-of select="@xml:id"/>
<xsl:text>}&#x000a;</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates/>
<xsl:text>&#x000a;\end{EOAequation</xsl:text>
<xsl:choose>
<xsl:when test="@n='nonumber'">
<xsl:text>nonumber}</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>}</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>&#x000a;</xsl:text>
</xsl:template>
<xsl:template match="tei:body//tei:ab[@type='subequations']">
<xsl:call-template name="begin_paragraph"/>
<xsl:text>\begin{EOAsubequations}{</xsl:text>
<xsl:value-of select="./@xml:id"/>
<xsl:text>}&#x000a;\begin{align}&#x000a;</xsl:text>
<xsl:apply-templates/>
<xsl:text>\end{align}&#x000a;\end{EOAsubequations}</xsl:text>
<xsl:text>&#x000a;</xsl:text>
</xsl:template>
<xsl:template match="tei:body//tei:ab[@type='equationarray']">
<xsl:call-template name="begin_paragraph"/>
<xsl:text>\begin{EOAequationarray</xsl:text>
<xsl:choose>
<xsl:when test="@n='nonumber'">
<xsl:text>nonumber}&#x000a;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>}{</xsl:text>
<xsl:value-of select="@xml:id"/>
<xsl:text>}&#x000a;</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates/>
<xsl:text>\end{EOAequationarray</xsl:text>
<xsl:choose>
<xsl:when test="@n='nonumber'">
<xsl:text>nonumber</xsl:text>
</xsl:when>
</xsl:choose>
<xsl:text>}</xsl:text>
<xsl:text>&#x000a;</xsl:text>
</xsl:template>
<xsl:template match="tei:ab[@type = ('subequations', 'equationarray')]/tei:formula[@notation = 'tex']">
<xsl:apply-templates/>
<xsl:if test="following-sibling::*">
<xsl:text>\\</xsl:text>
</xsl:if>
<xsl:text>&#x000a;</xsl:text>
</xsl:template>
<xsl:template match="tei:body//tei:p[not(ancestor::tei:note) and not(parent::tei:div[@type = 'letter']) and not(parent::tei:epigraph)]">
<xsl:call-template name="begin_paragraph"/>
<xsl:if test="
preceding-sibling::*[1][self::tei:figure[not(@type='hionly*')]] and $indentfloats
or preceding-sibling::*[1][self::tei:ab[@type = 'chapterabstract']]
or preceding-sibling::*[1][self::tei:quote | self::tei:list]
">
<xsl:text>\noindent </xsl:text>
</xsl:if>
<xsl:apply-templates />
<xsl:text>&#x000a;</xsl:text>
</xsl:template>
<xsl:template match="tei:lg[@type = 'verse']">
<xsl:call-template name="begin_paragraph"/>
<xsl:text>\begin{EOAverse}</xsl:text>
<xsl:text>&#x000a;</xsl:text>
<xsl:for-each select="tei:l">
<xsl:apply-templates select="."/>
<xsl:if test="position() != last()">
<xsl:text>\\</xsl:text>
</xsl:if>
<xsl:text>&#x000a;</xsl:text>
</xsl:for-each>
<xsl:text>\end{EOAverse}</xsl:text>
<xsl:text>&#x000a;</xsl:text>
</xsl:template>
<xsl:template match="tei:lg[@type = 'verse']/tei:l">
<xsl:text> </xsl:text>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="tei:epigraph">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="tei:epigraph/tei:p">
<xsl:call-template name="begin_paragraph"/>
<xsl:text>\begin{flushright}</xsl:text>
<xsl:text>&#x000a;</xsl:text>
<xsl:apply-templates />
<xsl:text>&#x000a;</xsl:text>
<xsl:text>\end{flushright}</xsl:text>
<xsl:text>&#x000a;</xsl:text>
</xsl:template>
<xsl:template match="tei:table">
<xsl:call-template name="begin_paragraph"/>
<xsl:variable name="number_cells" as="xs:integer*">
<xsl:value-of select="count(./tei:row[1]/tei:cell)"/>
</xsl:variable>
<xsl:text>\begin{EOAtable}</xsl:text>
<xsl:choose>
<xsl:when test="@rend='blank'">
<xsl:text>[blank]</xsl:text>
</xsl:when>
</xsl:choose>
<xsl:text>{</xsl:text>
<xsl:for-each select="1 to $number_cells">L{4cm} </xsl:for-each>
<xsl:text>} </xsl:text>
<xsl:choose>
<xsl:when test="@n='nonumber'">
<xsl:text>{nonumber}</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="tablehead"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text>{</xsl:text>
<xsl:value-of select="@xml:id"/>
<xsl:text>}</xsl:text>
<xsl:choose>
<xsl:when test="$strictfloats">
<xsl:text>{!ht}</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>{ht}</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="./tei:row"/>
<xsl:text>&#x000a;\end{EOAtable}</xsl:text>
<xsl:text>&#x000a;</xsl:text>
</xsl:template>
<xsl:template name="tablehead">
<xsl:text>&#x000a; {</xsl:text>
<xsl:apply-templates select="./tei:head"/>
<xsl:text>}</xsl:text>
</xsl:template>
<xsl:template match="tei:row">
<xsl:choose>
<xsl:when test="@role='label'">
<xsl:text>&#x000a;\EOAtablehead{</xsl:text>
<xsl:apply-templates/>
<xsl:text>} </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>&#x000a; </xsl:text>
<xsl:apply-templates/>
<xsl:text>\\ </xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="tei:cell/tei:lb">
<xsl:text>\newline </xsl:text>
</xsl:template>
<xsl:template match="tei:cell">
<xsl:if test="preceding-sibling::tei:cell">
<xsl:text>⸏ </xsl:text>
</xsl:if>
<xsl:apply-templates/>
</xsl:template>
<!-- head -->
<xsl:template match="tei:div[ @type = ('chapter', 'chapteroriginal', 'chaptertranslation')]/tei:head">
<xsl:value-of select="eoa:debug(0, 'chapter heading: ', .)"/>
<xsl:text>\EOAchapter</xsl:text>
<xsl:choose>
<xsl:when test="../@n='nonumber'">
<xsl:text>nonumber</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="eoa:debug(1, concat('Chapter has number: ', @n), '')" />
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="tei:choice">
<xsl:text>{</xsl:text>
<xsl:apply-templates select="tei:choice/tei:abbr/node()"/>
<xsl:text>}{</xsl:text>
<xsl:apply-templates select="tei:choice/tei:expan/node()"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>{</xsl:text>
<xsl:apply-templates/>
<xsl:text>}{</xsl:text>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
<xsl:for-each select="..">
<xsl:call-template name="eoaauthor"/>
</xsl:for-each>
<xsl:text>}</xsl:text>
</xsl:template>
<xsl:template match="tei:head">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="tei:list">
<xsl:call-template name="begin_paragraph"/>
<xsl:choose>
<xsl:when test="@type='ordered'">
<xsl:text>\begin{EOAlist}&#x000a;</xsl:text>
<xsl:apply-templates select="./tei:item"/>
<xsl:text>\end{EOAlist}</xsl:text>
</xsl:when>
<xsl:when test="@type='unordered'">
<xsl:text>\begin{EOAitems}&#x000a;</xsl:text>
<xsl:apply-templates select="./tei:item"/>
<xsl:text>\end{EOAitems}</xsl:text>
</xsl:when>
<xsl:when test="@type='gloss'">
<xsl:text>\begin{EOAdescription}&#x000a;</xsl:text>
<xsl:call-template name="description"/>
<xsl:text>\end{EOAdescription}</xsl:text>
</xsl:when>
</xsl:choose>
<xsl:text>&#x000a;</xsl:text>
</xsl:template>
<xsl:template match="//tei:item">
<xsl:choose>
<xsl:when test="preceding-sibling::*[1][self::tei:label]">
<xsl:apply-templates/>
<xsl:text>&#x000a;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>\item </xsl:text>
<xsl:apply-templates/>
<xsl:text>&#x000a;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="//tei:figure">
<xsl:call-template name="begin_paragraph"/>
<xsl:choose>
<xsl:when test="not(@type) or @type='hitrue'">
<xsl:choose>
<xsl:when test="@rend='landscape'">
<xsl:text>\EOAlsfigure</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>\EOAfigure</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="@n='nonumber'">
<xsl:text>nonumber{</xsl:text>
<xsl:value-of select="./tei:graphic/@url"/>
<xsl:text>}{</xsl:text>
<xsl:value-of select="./tei:graphic/@scale"/>
<xsl:text>}{</xsl:text>
<xsl:choose>
<xsl:when test="@place">
<xsl:value-of select="@place"/>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$strictfloats">
<xsl:text>!ht</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>ht</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
<xsl:text>}</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>{</xsl:text>
<xsl:value-of select="./tei:graphic/@url"/>
<xsl:text>}{</xsl:text>
<xsl:apply-templates select="./tei:head"/>
<xsl:text>}</xsl:text>
<xsl:text>{</xsl:text>
<xsl:value-of select="@xml:id"/>
<xsl:text>}</xsl:text>
<xsl:choose>
<xsl:when test="not(@rend='landscape')">
<xsl:text>{</xsl:text>
<xsl:value-of select="./tei:graphic/@scale"/>
<xsl:text>}{</xsl:text>
<xsl:choose>
<xsl:when test="@place">
<xsl:value-of select="@place"/>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$strictfloats">
<xsl:text>!ht</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>ht</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
<xsl:text>}</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="@type='hionlysub'">
<xsl:value-of select="eoa:texcomment('Subfigure that only shows in Hyperimage.')" />
</xsl:when>
<xsl:when test="@type='hionlycollage'">
<xsl:value-of select="eoa:texcomment('Collage that only shows in Hyperimage.')" />
</xsl:when>
<xsl:when test="@type='hionly'">
<xsl:text>&#x000a;\refstepcounter{figure}&#x2E0E;&#x000a;\hionlyfigid{</xsl:text>
<xsl:value-of select="@xml:id"/>
<xsl:text>}</xsl:text>
</xsl:when>
</xsl:choose>
<xsl:text>&#x000a;</xsl:text>
</xsl:template>
<xsl:template match="tei:div[@type='bilingual']">
<xsl:call-template name="begin_paragraph"/>
<xsl:text>\begin{EOAtranscripted}{</xsl:text>
<xsl:apply-templates select="./tei:div[@type='original']/tei:head"/>
<xsl:text>}{</xsl:text>
<xsl:apply-templates select="./tei:div[@type='translation']/tei:head"/>
<xsl:text>}&#x000a;</xsl:text>
<xsl:apply-templates select="./tei:div[@type='original']"/>
<xsl:text>&#x000a;\EOAnewpage&#x000a;</xsl:text>
<xsl:apply-templates select="./tei:div[@type='translation']"/>
<xsl:text>&#x000a;\end{EOAtranscripted}</xsl:text>
<xsl:text>&#x000a;</xsl:text>
</xsl:template>
<xsl:template match="tei:div[@type='bilingual']/tei:div[@type = ('original', 'translation')]">
<xsl:apply-templates select="*[not(self::tei:head)]"/>
</xsl:template>
<xsl:template match="tei:div[@type='letter']">
<xsl:call-template name="begin_paragraph"/>
<xsl:text>\EOAletterhead{</xsl:text>
<xsl:apply-templates select="tei:head"/>
<xsl:if test="tei:opener/tei:date">
<xsl:text>, </xsl:text>
<xsl:value-of select="tei:opener/tei:date"/>
</xsl:if>
<xsl:text>}{</xsl:text>
<xsl:choose>
<xsl:when test="tei:opener/tei:date">
<xsl:text>Call number </xsl:text>
<xsl:value-of select="tei:opener/tei:idno[@type='callnumber']"/>
</xsl:when>
<xsl:otherwise>
<xsl:sequence select="eoa:debug(2, 'call number not specified in letter ', tei:head)"/>
<xsl:text>Unknown call number</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>}{</xsl:text>
<xsl:choose>
<xsl:when test="tei:opener/tei:note[@type = 'writingstyle']">
<xsl:value-of select="tei:opener/tei:note[@type = 'writingstyle']"/>
</xsl:when>
<xsl:otherwise>
<xsl:sequence select="eoa:debug(2, 'writing style not specified in letter ', tei:head)"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text>}{</xsl:text>
<xsl:choose>
<xsl:when test="tei:opener/tei:measure[@commodity = 'pages']/@quantity">
<xsl:value-of select="tei:opener/tei:measure[@commodity = 'pages']/@quantity"/>
</xsl:when>
<xsl:otherwise>
<xsl:sequence select="eoa:debug(2, 'number of pages not specified in letter ', tei:head)"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text>}</xsl:text>
<xsl:text>&#x000a;</xsl:text>
<xsl:apply-templates select="tei:p"/>
</xsl:template>
<xsl:template match="tei:div[@type = 'letter']/tei:p">
<xsl:text>&#x000a;</xsl:text>
<xsl:apply-templates />
<xsl:text>&#x000a;</xsl:text>
</xsl:template>
<!--
<xsl:template match="tei:div[@type='sidebyside']">
<xsl:if test="preceding-sibling::*">
<xsl:text>&#x000a;</xsl:text>
</xsl:if>
<xsl:variable name="facsim_id" select="substring-after(tei:pb/@facs, '#')"/>
<xsl:variable name="facsim_path" select="//tei:teiHeader//tei:facsimile/tei:surname[ @xml:id = $facsim_id]/tei:graphic/@url"/>
<xsl:text>\EOAfacsimile[</xsl:text>
<xsl:value-of select="$facsim_id"/>
<xsl:text>]{</xsl:text>
<xsl:value-of select="$facsim_path"/>
<xsl:text>&#x000a;</xsl:text>
</xsl:template>
-->
<!-- inline elements -->
<xsl:template match="tei:formula[@rend = 'inline']">
<!--
<xsl:template match="tei:formula">
-->
<xsl:choose>
<xsl:when test="@notation='mhchem'">
<xsl:text>\EOAchem{</xsl:text>
<xsl:apply-templates/>
<xsl:text>}</xsl:text>
</xsl:when>
<xsl:when test="@notation='tex'">
<xsl:choose>
<xsl:when test="@rend='inline'">
<xsl:text>\EOAineq{</xsl:text>
<xsl:apply-templates />
<xsl:text>}</xsl:text>
</xsl:when>
<xsl:when test="ancestor::tei:ab[@type='subequations' or @type='equationarray']">
<xsl:choose>
<xsl:when test="position() != last()">
<xsl:apply-templates/>
<xsl:text>\\&#x000a;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="tei:foreign">
<xsl:choose>
<xsl:when test="@xml:lang='ru'">
<xsl:text>\EOArussian{</xsl:text>
<xsl:apply-templates />
<xsl:text>}</xsl:text>
</xsl:when>
<xsl:when test="@xml:lang='zh'">
<xsl:text>\EOAchinese{</xsl:text>
<xsl:apply-templates />
<xsl:text>}</xsl:text>
</xsl:when>
<xsl:when test="@xml:lang='he'">
<xsl:text>\EOAhebrew{</xsl:text>
<xsl:apply-templates />
<xsl:text>}</xsl:text>
</xsl:when>
<xsl:when test="@xml:lang='el'">
<xsl:text>\EOAgreek{</xsl:text>
<xsl:apply-templates />
<xsl:text>}</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="tei:body//tei:graphic[not(ancestor::tei:figure)]">
<xsl:choose>
<xsl:when test="@scale">
<xsl:text>\includegraphics</xsl:text>
<xsl:text>[width=0.</xsl:text>
<xsl:value-of select="@scale"/>
<xsl:text>\textwidth,keepaspectratio]</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>\EOAinline</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>{</xsl:text>
<xsl:value-of select="@url"/>
<xsl:text>}</xsl:text>
</xsl:template>
<xsl:template match="//tei:hi[@rend='italic']" >
<xsl:text>\EOAemph{</xsl:text>
<xsl:apply-templates />
<xsl:text>}</xsl:text>
</xsl:template>
<xsl:template match="//tei:hi[@rend='subscript']" >
<xsl:text>\EOAdown{</xsl:text>
<xsl:apply-templates />
<xsl:text>}</xsl:text>
</xsl:template>
<xsl:template match="//tei:hi[@rend='superscript']" >
<xsl:text>\EOAup{</xsl:text>
<xsl:apply-templates />
<xsl:text>}</xsl:text>
</xsl:template>
<xsl:template match="//tei:hi[@rend='bold']" >
<xsl:text>\EOAbold{</xsl:text>
<xsl:apply-templates />
<xsl:text>}</xsl:text>
</xsl:template>
<xsl:template match="//tei:hi[@rend='smallcaps']" >
<xsl:text>\EOAcaps{</xsl:text>
<xsl:apply-templates />
<xsl:text>}</xsl:text>
</xsl:template>
<xsl:template match="//tei:hi[@rend='math']" >
<xsl:text>\EOAmathfont{</xsl:text>
<xsl:apply-templates />
<xsl:text>}</xsl:text>
</xsl:template>
<xsl:template match="//tei:bibl">
<xsl:choose>
<xsl:when test="./tei:ref[@type='year']">
<xsl:text>\EOAciteyear</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>\EOAciteauthoryear</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="./tei:citedRange[not(@*)]">
<xsl:text>[</xsl:text>
<xsl:apply-templates select="./tei:citedRange/node()"/>
<xsl:text>]</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="./tei:citedRange/@from">
<xsl:text>[</xsl:text>
<xsl:value-of select="./tei:citedRange/@from"/>
<xsl:choose>
<xsl:when test="./tei:citedRange/@to">
<xsl:text>–</xsl:text>
<xsl:value-of select="./tei:citedRange/@to"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="eoa:debug(1, 'Citation has no @to value. ', tei:ref/@target)" />
</xsl:otherwise>
</xsl:choose>
<xsl:text>]</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
<xsl:text>{</xsl:text>
<xsl:value-of select="substring-after(./tei:ref/@target, '#')"/>
<xsl:text>}</xsl:text>
</xsl:template>
<xsl:template match="//tei:note[@place='bottom']">
<xsl:text>\EOAfn{</xsl:text>
<xsl:text>\EOAlabel{</xsl:text>
<xsl:value-of select="./@xml:id"/>
<xsl:text>}</xsl:text>
<xsl:choose>
<xsl:when test="count(./tei:p)=1">
<xsl:apply-templates/>
</xsl:when>
<xsl:when test="count(./tei:p)>1">
<xsl:sequence select="eoa:debug(0, 'Number of paragraphs in larger than 1 ', name())" />
<xsl:for-each select="./tei:p">
<xsl:choose>
<xsl:when test="position() != last()">
<xsl:apply-templates />
<xsl:text>\EOAfnpar </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:when>
</xsl:choose>
<xsl:text>}</xsl:text>
</xsl:template>
<xsl:template match="tei:note[@place = 'bottom']//tei:p">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="//tei:body//tei:ref[@type='hionlycollage']">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="//tei:body//tei:ref[@type='text-hi']">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="//tei:body//tei:ref[@type='number-hi']">
<xsl:text>\EOAref{</xsl:text>
<xsl:value-of select="substring-after(@target, '#')"/>
<xsl:text>}</xsl:text>
</xsl:template>
<xsl:template match="//tei:body//tei:ref[@type='number-hionly']">
<xsl:text>\hionlyfignumber{</xsl:text>
<xsl:value-of select="substring-after(@target, '#')"/>
<xsl:text>}</xsl:text>
<!-- target="#chap02_fig13-hi -->
<!-- <xsl:value-of select="replace(@target, '#chap[0-9]{1,2}_fig([0-9]{1,2})(-hi)?', '$1')"/> -->
<!-- <xsl:value-of select="substring-after(@target, '#')"/> -->
</xsl:template>
<xsl:template match="//tei:body//tei:ref[@type='number']">
<xsl:text>\EOAref{</xsl:text>
<xsl:value-of select="substring-after(@target, '#')"/>
<xsl:text>}</xsl:text>
</xsl:template>
<xsl:template match="//tei:body//tei:ref[@type='page']">
<xsl:text>\EOApageref{</xsl:text>
<xsl:value-of select="substring-after(@target, '#')"/>
<xsl:text>}</xsl:text>
</xsl:template>
<xsl:template match="//tei:body//tei:ref[@type='url']">
<xsl:text>\EOAurl{</xsl:text>
<xsl:value-of select="@target"/>
<xsl:choose>
<xsl:when test="./tei:date">
<xsl:choose>
<!-- this should check also the chapter language setting -->
<xsl:when test="//tei:profileDesc/tei:langUsage/tei:language[@ident='en']">
<xsl:text>}, accessed </xsl:text>
<xsl:value-of select="format-date(xs:date(./tei:date/@when),
'[MNn] [D], [Y0001]')"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>}, FOOL</xsl:text>
</xsl:otherwise>
</xsl:choose>
<!-- <xsl:text>.</xsl:text> -->
</xsl:when>
<xsl:otherwise>
<xsl:text>}</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="description">
<xsl:for-each select="./tei:label">
<xsl:text>\item[</xsl:text>
<!-- <xsl:value-of select="."/> -->
<xsl:apply-templates/>
<xsl:text>] </xsl:text>
<xsl:apply-templates select="following-sibling::tei:item[1]"/>
</xsl:for-each>
</xsl:template>
<xsl:template match="//tei:index">
<xsl:choose>
<xsl:when test="@indexName='keyword'">
<xsl:text>\EOAindex{</xsl:text>
</xsl:when>
<xsl:when test="@indexName='person'">
<xsl:text>\EOAindexperson{</xsl:text>
</xsl:when>
<xsl:when test="@indexName='location'">
<xsl:text>\EOAindexlocation{</xsl:text>
</xsl:when>
</xsl:choose>
<xsl:apply-templates select="./tei:term"/>
<xsl:if test="@spanTo">
<xsl:text>|(</xsl:text>
</xsl:if>
<xsl:text>}</xsl:text>
</xsl:template>
<xsl:template match="//tei:term">
<xsl:choose>
<xsl:when test="@sortKey">
<xsl:value-of select="@sortKey"/>
<xsl:text>@</xsl:text>
</xsl:when>
</xsl:choose>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="//tei:anchor">
<xsl:variable name="anchor" select="@xml:id"/>
<xsl:choose>
<!-- this here does not work -->
<!-- <xsl:when test="//tei:index[@spanTo='#indInd']/@indexName='keyword'"> -->
<xsl:when test="//tei:index[@spanTo='#$anchor']/@indexName='keyword'">
<xsl:text>\EOAindex{</xsl:text>
</xsl:when>
<xsl:when test="//tei:index[@spanTo='#indInd']/@indexName='person'">
<xsl:text>\EOAindexperson{</xsl:text>
</xsl:when>
<xsl:when test="//tei:index[@spanTo='#indInd']/@indexName='location'">
<xsl:text>\EOAindexlocation{</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>\EOAbold{</xsl:text>
<xsl:value-of select="$anchor"/>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="//tei:index[@spanTo='#indInd']/tei:term"/>
<xsl:text>|)}</xsl:text>
</xsl:template>
<xsl:template match="//tei:pb[@facs]">
<!-- <pb facs="#facsim003"/> -->
<!--
<facsimile>
<surface corresp="#p6v-transcr" xml:id="facsim003">
<graphic scale="50" url="facsim/003.jpg"/>
<label>Facsimile of page 3</label>
</surface>
-->
<xsl:variable name="facsim_id" select="substring-after(@facs, '#')"/>
<xsl:variable name="facsim_path" select="//tei:facsimile/tei:surface[@xml:id = $facsim_id]/tei:graphic/@url"/>
<xsl:text>\EOAfacsimile{</xsl:text>
<xsl:value-of select="$facsim_path"/>
<xsl:text>}{</xsl:text>
<xsl:value-of select="$facsim_id"/>
<xsl:text>}{</xsl:text>
<xsl:apply-templates select="//tei:facsimile/tei:surface[@xml:id = $facsim_id]/tei:label"/>
<xsl:text>}&#x000a;</xsl:text>
</xsl:template>
<xsl:template name="begin_paragraph">
<xsl:if test="preceding-sibling::*[not(self::tei:head)]">
<xsl:text>&#x000a;</xsl:text>
</xsl:if>
</xsl:template>
</xsl:stylesheet>