<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><!-- ************************************************************************************************** --><!-- *** ELEMENT TEMPLATE ***************************************************************************** --><!-- ** VINDO-ELEMENTS.XSL:  stylesheet elements for Vindolanda TEI-EPIDOC xml files--><!--   Use this stylesheet with a root template such as VINDO-TABLET.XSL or VINDO-TABLET-BATCH.XSL  --> <!-- ************************************************************************************************** --><!--********** P ************--> <xsl:template match="p">  <p> <xsl:apply-templates/></p>  </xsl:template>	<!--********** UNCLEAR ************--> <xsl:template match="unclear">  <span class="unclear"> <xsl:value-of select="."/></span>  </xsl:template>	<!--********** EMPH ************--> <xsl:template match="emph">  <span class="italic"> <!--<xsl:value-of select="."/>--> <xsl:apply-templates/></span>  </xsl:template>	<!--************ ADD ************--><xsl:template match="add"><xsl:when test="@place='supralinear'"><sup><xsl:apply-templates/></sup></xsl:when></xsl:template><!--******************************--><!--********** DEL ***************--><xsl:template match="del"><xsl:when test="@rend='erasure'"><xsl:text disable-output-escaping="yes">[[</xsl:text><xsl:apply-templates/><xsl:text disable-output-escaping="yes">]]</xsl:text></xsl:when></xsl:template><!--********** HANDSHIFT *********-->  <xsl:template match="handShift"><xsl:choose><xsl:when test="@new='hand1'"><span class="italic">m<sup>1</sup></span></xsl:when><xsl:when test="@new='hand2'"><span class="italic">m<sup>2</sup></span></xsl:when></xsl:choose></xsl:template><!--********** NOTE ************-->  <xsl:template match="note"><p><xsl:if test="@id"><A NAME="{@id}"/></xsl:if><span class="lineNote">        <xsl:value-of select="@n"/>&#160; &#160; &#160; &#160; &#160;       </span> <xsl:apply-templates/></p>	</xsl:template>   <!--********** REF ************-->  <xsl:template match="ref">  <xsl:choose>  	<xsl:when test="@type='tabletNum'">    <a href="../4DACTION/WebRequestQuery?searchTerm={.}&amp;searchType=number&amp;searchField=TVII&amp;thisListPosition=1&amp;thisPageNum=0" ><xsl:value-of select="."/></a></xsl:when>		<xsl:when test="@type='printedPage'">	</xsl:when>	</xsl:choose> </xsl:template><!--********** FOREIGN ************-->   <xsl:template match="foreign"> 	<xsl:choose> 	<xsl:when test="@lang='lat'"> 	<span class="italic"> 	<xsl:apply-templates/> 	</span> </xsl:when> </xsl:choose> </xsl:template>    <!--********** DIV-COMMENTARY ************--><xsl:template match="div[@type='commentary']"><xsl:value-of select="$fieldDelim" /><xsl:apply-templates /></xsl:template>  <!--********** DIV-TRANSLATION ************-->  <xsl:template match="div[@type='translation']"><xsl:value-of select="$fieldDelim" /><xsl:apply-templates/></xsl:template>  <!--********** DIV-DESCRIPTION ************--><xsl:template match="div[@type='description']"><xsl:value-of select="$fieldDelim" /><xsl:apply-templates /></xsl:template>  <!--********** DIV-EDITION ************--><xsl:template match="div[@type='edition']"><xsl:value-of select="$fieldDelim" /><table border='0' margin='0'><tr><td width='10%' ><!--note links--> </td><td width='3%'><!--spacer--></td><td width='10%'><!--line numbers--></td><td><!--line text--><xsl:apply-templates/></td></tr></table></xsl:template> <!--********** BR ***************--><xsl:template match="br"><br/></xsl:template><!--********** PB ***************--><xsl:template match="pb"><xsl:text disable-output-escaping="yes">&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;&lt;td &gt; &lt;/td&gt; &lt;td align="left" valign="top" &gt; &lt;/td&gt; &lt;td align="left" valign="top" &gt; &lt;/td&gt; &lt;td align="left" valign="top" &gt;</xsl:text><span class="leafNum"><xsl:value-of select="@n"/></span></xsl:template><!--********** LB ************-->  <xsl:template match="lb"><xsl:variable name="noteRangeStart" /><xsl:variable name="noteRangeEnd" /><xsl:variable name="thisTabletNum" select="substring-after(/TEI.2/@id, '_')"/><xsl:variable name="thisLineNum" select="@n" /><xsl:variable name="lineID" select="substring-after(@id, 'line')"/><xsl:variable name="thisFragment" select="substring-before($lineID, '-')"/><xsl:text disable-output-escaping="yes">&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td align="left" valign="top" &gt;</xsl:text><xsl:for-each select="following::note"> <!--Set Variables--><xsl:variable name="noteLinkSymbol" select="'n'"/><!--if note id contains a ' ' (whitespace separating frag ID and line) --><!--number)  then it is considered fragmentary--><xsl:variable name="fragmentaryNote"><xsl:choose><xsl:when test="contains(@n, ' ')"><xsl:text>true</xsl:text></xsl:when><xsl:otherwise><xsl:text>false</xsl:text></xsl:otherwise></xsl:choose></xsl:variable><xsl:variable name="noteFragment"><xsl:choose><xsl:when test="contains(@n, ' ')"><xsl:value-of select="substring-before(@n, ' ')"/></xsl:when><xsl:otherwise><xsl:text>0</xsl:text></xsl:otherwise></xsl:choose></xsl:variable><xsl:variable name="noteN"><xsl:choose><xsl:when test="contains(@n, ' ')"><xsl:value-of select="substring-after(@n, ' ')"/></xsl:when><xsl:otherwise><xsl:value-of select="@n"/></xsl:otherwise></xsl:choose></xsl:variable><!-- END Set Variables--><!--<xsl:text>Note frag: </xsl:text><xsl:value-of select="$noteFragment"/><xsl:text>this frag: </xsl:text><xsl:value-of select="$thisFragment"/><xsl:text>Frag note?: </xsl:text><xsl:value-of select="$fragmentaryNote"/><xsl:text>this line num: </xsl:text><xsl:value-of select="$thisLineNum"/><xsl:text>note number: </xsl:text><xsl:value-of select="$noteN"/>--><!--Print Note links--><!--if not fragmentary or if note belongs to this fragment --><xsl:if test="$noteFragment=$thisFragment or ($thisFragment='' and $fragmentaryNote='false')"><xsl:choose><xsl:when test="contains($noteN,'-')"><xsl:variable name="noteRangeStart" select="substring-before($noteN, '-')" /><xsl:variable name="noteRangeEnd" select="substring-after($noteN, '-')" /><xsl:choose><xsl:when test="$thisLineNum&lt;=$noteRangeEnd"><xsl:if test="$thisLineNum&gt;=$noteRangeStart"><span class="noteLinkNum"><a href="javascript:notesWin('../tablet-notes/{$thisTabletNum}-notes.html#{@id}','notesWin','1');"><xsl:value-of select="$noteLinkSymbol"/></a> <xsl:value-of select="' '"/></span>  </xsl:if></xsl:when><xsl:when test="$thisLineNum&gt;=$noteRangeStart"><xsl:if test="$thisLineNum&lt;=$noteRangeEnd"><span class="noteLinkNum"><a href="javascript:notesWin('../tablet-notes/{$thisTabletNum}-notes.html#{@id}','notesWin','1');"><xsl:value-of select="$noteLinkSymbol"/></a> <xsl:value-of select="' '"/></span> </xsl:if> </xsl:when></xsl:choose></xsl:when>  <!-- end when note is a note range--><xsl:when test="$noteN=$thisLineNum"><span class="noteLinkNum"><a href="javascript:notesWin('../tablet-notes/{$thisTabletNum}-notes.html#{@id}','notesWin','1');"><xsl:value-of select="$noteLinkSymbol"/></a> <xsl:value-of select="' '"/></span></xsl:when><xsl:otherwise></xsl:otherwise></xsl:choose></xsl:if></xsl:for-each><!-- ** END LINE NOTE LINKS --><xsl:text disable-output-escaping="yes">&lt;/td&gt; &lt;td align="left" valign="top" &gt;&lt;/td&gt; &lt;td align="left" valign="top" &gt;</xsl:text><xsl:choose><xsl:when test="$thisLineNum mod $lineInterval = 0"><span class="lineNum"><xsl:value-of select="$thisLineNum"/></span></xsl:when>      <xsl:otherwise></xsl:otherwise> 				  </xsl:choose> 			<xsl:text disable-output-escaping="yes">&lt;/td&gt; &lt;td align="left" valign="top"  &gt;</xsl:text></xsl:template></xsl:stylesheet>