<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet
  version="1.0"
  xmlns:name="http://namesforlife.com/ns/name"
  xmlns:taxon="http://namesforlife.com/ns/taxon"
  xmlns:exemplar="http://namesforlife.com/ns/exemplar"
  xmlns:reference="http://namesforlife.com/ns/reference"
  xmlns:common="http://namesforlife.com/ns/common"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  exclude-result-prefixes="name taxon exemplar reference common"
  >

  <xsl:include href="references.xsl" />

  <xsl:template name="logout-link">
    <div id="abstract-link">
      <img alt="right arrow" src="../images/chevron_right.png" /><xsl:text></xsl:text><a onClick="logout()">Logout</a>
    </div>
  </xsl:template>

  <!-- Empty table row -->
  <xsl:template name="table-row-empty">
    <tr><td colspan="2" class="empty"></td></tr>
  </xsl:template>

  <xsl:template name="doi-link">
    <xsl:param name="rel" select="self::node()[false()]" />
    <xsl:param name="title" />
    <xsl:param name="class" select="self::node()[false()]" />
    <xsl:param name="doi" />
    <xsl:param name="text" select="self::node()[false()]" />
    <a>
      <xsl:if test="$rel">
        <xsl:attribute name="rel"><xsl:value-of select="$rel" /></xsl:attribute>
      </xsl:if>
      <xsl:attribute name="title"><xsl:value-of select="$title" /></xsl:attribute>
      <xsl:attribute name="class"><xsl:text>doi </xsl:text><xsl:value-of select="$class" /></xsl:attribute>
      <xsl:choose>
        <xsl:when test="$rel='namesforlife-name'">
          <xsl:attribute name="href"><xsl:text>https://doi.org/</xsl:text><xsl:value-of select="$doi" /></xsl:attribute>
        </xsl:when>
        <xsl:otherwise>
          <xsl:attribute name="href"><xsl:text>https://doi.org/</xsl:text><xsl:value-of select="$doi" /></xsl:attribute>
        </xsl:otherwise>
      </xsl:choose>
      <xsl:attribute name="itemprop"><xsl:text>url</xsl:text></xsl:attribute>
      <xsl:value-of select="$text" />
    </a>
  </xsl:template>

  <xsl:template name="taxon-doi-link">
    <xsl:param name="doi" />
    <xsl:param name="name" />
    <xsl:call-template name="doi-link">
      <xsl:with-param name="rel" />
      <xsl:with-param name="title" select="$name" />
      <xsl:with-param name="class" />
      <xsl:with-param name="doi" select="$doi" />
      <xsl:with-param name="text" select="$doi" />
    </xsl:call-template>
  </xsl:template>

  <xsl:template name="exemplar-doi-link">
    <xsl:param name="doi" />
    <xsl:param name="name" />
    <xsl:call-template name="doi-link">
      <xsl:with-param name="rel" />
      <xsl:with-param name="title" select="$name" />
      <xsl:with-param name="class" />
      <xsl:with-param name="doi" select="$doi" />
      <xsl:with-param name="text" select="$doi" />
    </xsl:call-template>
  </xsl:template>

  <xsl:template name="taxon-rank-link">
    <xsl:param name="rank" />
    <xsl:param name="doi" />
    <xsl:param name="name" />
    <xsl:call-template name="doi-link">
      <xsl:with-param name="rel" />
      <xsl:with-param name="title" select="$name" />
      <xsl:with-param name="class" />
      <xsl:with-param name="doi" select="$doi" />
      <xsl:with-param name="text" select="$rank" />
    </xsl:call-template>
  </xsl:template>

  <xsl:template name="name-proper">
    <xsl:param name="status-code" />
    <xsl:param name="name" />
    <xsl:param name="rank" />
    <xsl:if test="$status-code='CA'"><i>Candidatus</i><xsl:text> </xsl:text></xsl:if>
    <span>
      <xsl:attribute name="class">
        <xsl:choose>
          <xsl:when test="$status-code='CA'">CA</xsl:when>
          <xsl:when test="$status-code='NVP'">NVP</xsl:when>
          <xsl:otherwise>VP</xsl:otherwise>
        </xsl:choose>
      </xsl:attribute>
      <xsl:value-of select="$name" />
    </span>
  </xsl:template>

  <xsl:template name="name-menu-link">
    <xsl:param name="name" />
    <xsl:param name="doi" />
    <xsl:call-template name="doi-link">
      <xsl:with-param name="rel"><xsl:text>namesforlife-name</xsl:text></xsl:with-param>
      <xsl:with-param name="title" select="$name" />
      <xsl:with-param name="class">namesforlife menu</xsl:with-param>
      <xsl:with-param name="doi"><xsl:value-of select="$doi" /></xsl:with-param>
      <xsl:with-param name="text" />
    </xsl:call-template>
  </xsl:template>

  <xsl:template name="name-taxon-link">
    <xsl:param name="name" />
    <xsl:param name="rank" />
    <xsl:param name="doi" />
    <xsl:call-template name="doi-link">
      <xsl:with-param name="rel"><xsl:text>tag</xsl:text></xsl:with-param>
      <xsl:with-param name="title" select="$name" />
      <xsl:with-param name="doi" select="$doi" />
      <xsl:with-param name="text">
        <xsl:value-of select="$name" />
      </xsl:with-param>
    </xsl:call-template>
  </xsl:template>

  <xsl:template name="name-authority-link">
    <xsl:param name="status-code" />
    <xsl:param name="name" />
    <xsl:param name="rank" />
    <xsl:param name="doi" />
    <xsl:param name="authority" />
    <xsl:if test="$status-code='CA'"><i>Candidatus</i><xsl:text> </xsl:text></xsl:if>
    <xsl:call-template name="doi-link">
      <xsl:with-param name="rel"><xsl:text>tag</xsl:text></xsl:with-param>
      <xsl:with-param name="title" select="$name" />
      <xsl:with-param name="class">
        <xsl:choose>
          <xsl:when test="$status-code='CA'">CA</xsl:when>
          <xsl:when test="$status-code='NVP'">NVP</xsl:when>
          <xsl:otherwise>VP</xsl:otherwise>
        </xsl:choose>
      </xsl:with-param>
      <xsl:with-param name="doi" select="$doi" />
      <xsl:with-param name="text">
        <xsl:value-of select="$name" />
      </xsl:with-param>
    </xsl:call-template>
    <xsl:text> </xsl:text>
    <xsl:value-of select="$authority" />
  </xsl:template>

  <xsl:template name="name-name-link">
    <xsl:param name="status-code" />
    <xsl:param name="name" />
    <xsl:param name="rank" />
    <xsl:param name="doi" />
    <xsl:if test="$status-code='CA'"><i>Candidatus</i><xsl:text> </xsl:text></xsl:if>
    <xsl:call-template name="doi-link">
      <xsl:with-param name="rel"><xsl:text>tag</xsl:text></xsl:with-param>
      <xsl:with-param name="title" select="$name" />
      <xsl:with-param name="class">
        <xsl:choose>
          <xsl:when test="$status-code='CA'">CA</xsl:when>
          <xsl:when test="$status-code='NVP'">NVP</xsl:when>
          <xsl:otherwise>VP</xsl:otherwise>
        </xsl:choose>
      </xsl:with-param>
      <xsl:with-param name="doi" select="$doi" />
      <xsl:with-param name="text">
        <xsl:value-of select="$name" />
      </xsl:with-param>
    </xsl:call-template>
    <xsl:text> </xsl:text>
  </xsl:template>

  <xsl:template name="complete-link">
    <xsl:param name="status-code" />
    <xsl:param name="name" />
    <xsl:param name="rank" />
    <xsl:param name="doi" />
    <xsl:param name="authority" />
<!--
    <xsl:call-template name="name-menu-link">
      <xsl:with-param name="name" select="$name" />
      <xsl:with-param name="doi" select="$doi" />
    </xsl:call-template>
    <xsl:text></xsl:text>
-->
    <xsl:call-template name="name-authority-link">
      <xsl:with-param name="name" select="$name" />
      <xsl:with-param name="doi" select="$doi" />
      <xsl:with-param name="rank" select="$rank" />
      <xsl:with-param name="status-code" select="$status-code" />
      <xsl:with-param name="authority" select="$authority" />
    </xsl:call-template>
  </xsl:template>

  <xsl:template match="common:name-status-group" mode="proper">
    <xsl:call-template name="name-proper">
      <xsl:with-param name="status-code" select="common:status/@status-code" />
      <xsl:with-param name="rank" select="common:identifier/@rank" />
      <xsl:with-param name="name" select="common:identifier/text()" />
    </xsl:call-template>
    <xsl:text> </xsl:text>
    <xsl:apply-templates select="common:authority" mode="proper" />
  </xsl:template>

  <xsl:template match="common:authority" mode="proper">
    <xsl:apply-templates select="." />
  </xsl:template>

  <xsl:template match="name:name" mode="menu-link">
    <xsl:call-template name="name-menu-link">
      <xsl:with-param name="name" select="common:nomenclature/common:name-status-group/common:identifier" />
      <xsl:with-param name="doi" select="common:nomenclature/common:name-status-group/common:identifier/@doi" />
    </xsl:call-template>
  </xsl:template>

  <xsl:template match="name:name" mode="name-link">
    <xsl:call-template name="name-name-link">
      <xsl:with-param name="status-code" select="common:nomenclature/common:name-status-group/common:status/@status-code" />
      <xsl:with-param name="rank" select="common:nomenclature/common:name-status-group/common:identifier/@rank" />
      <xsl:with-param name="name" select="common:nomenclature/common:name-status-group/common:identifier" />
      <xsl:with-param name="doi" select="common:nomenclature/common:name-status-group/common:identifier/@doi" />
    </xsl:call-template>
  </xsl:template>
  
  <xsl:template match="name:name" mode="name-authority-link">
    <xsl:call-template name="name-authority-link">
      <xsl:with-param name="status-code" select="common:nomenclature/common:name-status-group/common:status/@status-code" />
      <xsl:with-param name="rank" select="common:nomenclature/common:name-status-group/common:identifier/@rank" />
      <xsl:with-param name="name" select="common:nomenclature/common:name-status-group/common:identifier" />
      <xsl:with-param name="authority" select="common:nomenclature/common:name-status-group/common:authority" />
      <xsl:with-param name="doi" select="common:nomenclature/common:name-status-group/common:identifier/@doi" />
    </xsl:call-template>
  </xsl:template>

  <xsl:template match="name:name" mode="complete-link">
    <xsl:call-template name="complete-link">
      <xsl:with-param name="status-code" select="common:nomenclature/common:name-status-group/common:status/@status-code" />
      <xsl:with-param name="rank" select="common:nomenclature/common:name-status-group/common:identifier/@rank" />
      <xsl:with-param name="name" select="common:nomenclature/common:name-status-group/common:identifier" />
      <xsl:with-param name="doi" select="common:nomenclature/common:name-status-group/common:identifier/@doi" />
      <xsl:with-param name="authority" select="common:nomenclature/common:name-status-group/common:authority" />
    </xsl:call-template>
  </xsl:template>

  <xsl:template match="common:name-status-group" mode="taxon-doi-link">
    <xsl:call-template name="taxon-doi-link">
      <xsl:with-param name="doi" select="common:identifier/@taxon-doi" />
      <xsl:with-param name="name" select="common:identifier" />
    </xsl:call-template>
  </xsl:template>
  
  <xsl:template match="common:name-status-group" mode="taxon-rank-link">
    <xsl:call-template name="taxon-rank-link">
      <xsl:with-param name="rank" select="common:identifier/@rank" />
      <xsl:with-param name="name" select="common:identifier" />
      <xsl:with-param name="doi" select="common:identifier/@taxon-doi" />
    </xsl:call-template>
  </xsl:template>

  <xsl:template match="exemplar:name" mode="taxon-doi-link">
    <xsl:call-template name="taxon-doi-link">
      <xsl:with-param name="doi" select="@taxon-doi" />
      <xsl:with-param name="name" select="text()" />
    </xsl:call-template>
  </xsl:template>

  <xsl:template match="exemplar:exemplar" mode="exemplar-doi-link">
    <xsl:call-template name="exemplar-doi-link">
      <xsl:with-param name="doi" select="@doi" />
      <xsl:with-param name="name" select="@doi" />
    </xsl:call-template>
  </xsl:template>

  <xsl:template match="common:name-status-group" mode="name-authority-link">
    <xsl:call-template name="name-authority-link">
      <xsl:with-param name="status-code" select="common:status/@status-code" />
      <xsl:with-param name="rank" select="common:identifier/@rank" />
      <xsl:with-param name="name" select="common:identifier/text()" />
      <xsl:with-param name="authority" select="common:authority" />
      <xsl:with-param name="doi" select="common:identifier/@doi" />
    </xsl:call-template>
  </xsl:template>

  <xsl:template match="common:name-status-group" mode="name-taxon-link">
    <xsl:call-template name="name-taxon-link">
      <xsl:with-param name="rank" select="common:identifier/@rank" />
      <xsl:with-param name="name" select="common:identifier/text()" />
      <xsl:with-param name="doi" select="common:identifier/@taxon-doi" />
    </xsl:call-template>
  </xsl:template>

  <xsl:template match="common:name-status-group" mode="name-link">
    <xsl:call-template name="name-name-link">
      <xsl:with-param name="status-code" select="common:status/@status-code" />
      <xsl:with-param name="rank" select="common:identifier/@rank" />
      <xsl:with-param name="name" select="common:identifier/text()" />
      <xsl:with-param name="doi" select="common:identifier/@doi" />
    </xsl:call-template>
  </xsl:template>

  <xsl:template match="taxon:taxon|taxon:parent|taxon:child|taxon:ancestor" mode="proper">
    <xsl:call-template name="name-proper">
      <xsl:with-param name="status-code" select="common:nomenclature/common:name-status-group[1]/common:status/@status-code" />
      <xsl:with-param name="name" select="common:nomenclature/common:name-status-group[1]/common:identifier" />
      <xsl:with-param name="doi" select="common:nomenclature/common:name-status-group[1]/common:identifier/@doi" />
    </xsl:call-template>
  </xsl:template>

  <xsl:template match="taxon:taxon|taxon:parent|taxon:child|taxon:ancestor" mode="taxon-doi-link">
    <xsl:call-template name="taxon-doi-link">
      <xsl:with-param name="name" select="common:nomenclature/common:name-status-group[1]/common:identifier" />
      <xsl:with-param name="doi" select="common:nomenclature/common:name-status-group[1]/common:identifier/@doi" />
    </xsl:call-template>
  </xsl:template>

  <xsl:template match="taxon:parent|taxon:child|taxon:ancestor" mode="taxon-name-link">
    <xsl:call-template name="name-authority-link">
      <xsl:with-param name="status-code" select="common:nomenclature/common:name-status-group[1]/common:status/@status-code" />
      <xsl:with-param name="rank" select="common:nomenclature/common:name-status-group[1]/common:identifier/@rank" />
      <xsl:with-param name="name" select="common:nomenclature/common:name-status-group[1]/common:identifier" />
      <xsl:with-param name="authority" select="common:nomenclature/common:name-status-group[1]/common:authority" />
      <xsl:with-param name="doi" select="common:nomenclature/common:name-status-group[1]/common:identifier/@doi" />
    </xsl:call-template>
  </xsl:template>

  <xsl:template match="taxon:parent|taxon:child|taxon:ancestor" mode="taxon-rank-link">
    <!-- Note: Any taxon element may contain more than one name-status-group (e.g., corrected names). -->
    <xsl:apply-templates select="common:nomenclature/common:name-status-group[1]" mode="taxon-rank-link" />
  </xsl:template>

  <xsl:template match="taxon:parent|taxon:child|taxon:ancestor" mode="complete-link">
    <xsl:call-template name="complete-link">
      <xsl:with-param name="status-code" select="common:nomenclature/common:name-status-group[1]/common:status/@status-code" />
      <xsl:with-param name="rank" select="common:nomenclature/common:name-status-group[1]/common:identifier/@rank" />
      <xsl:with-param name="name" select="common:nomenclature/common:name-status-group[1]/common:identifier" />
      <xsl:with-param name="authority" select="common:nomenclature/common:name-status-group[1]/common:authority" />
      <xsl:with-param name="doi" select="common:nomenclature/common:name-status-group[1]/common:identifier/@doi" />
    </xsl:call-template>
  </xsl:template>

  <xsl:template match="common:name-status-group" mode="complete-link">
    <xsl:call-template name="complete-link">
      <xsl:with-param name="status-code" select="common:status/@status-code" />
      <xsl:with-param name="rank" select="common:identifier/@rank" />
      <xsl:with-param name="name" select="common:identifier/text()" />
      <xsl:with-param name="authority" select="common:authority" />
      <xsl:with-param name="doi" select="common:identifier/@doi" />
    </xsl:call-template>
  </xsl:template>

  <xsl:template match="common:nomenclature" mode="names-and-authorities">
    <xsl:apply-templates select="common:name-status-group" mode="names-and-authorities" />
  </xsl:template>

  <xsl:template match="common:name-status-group" mode="names-and-authorities">
    <xsl:choose>
      <xsl:when test="position() = 1"></xsl:when>
      <xsl:when test="position() = last()">
        <xsl:text> and </xsl:text>
      </xsl:when>
      <xsl:otherwise>
        <xsl:text>, </xsl:text>
      </xsl:otherwise>
    </xsl:choose>
    <xsl:apply-templates select="." mode="name-authority" />
  </xsl:template>

  <xsl:template match="common:name-status-group" mode="name-authority">
    <xsl:value-of select="common:identifier/text()" />
    <xsl:text> </xsl:text>
    <xsl:value-of select="common:authority/text()" />
  </xsl:template>

  <xsl:template match="common:name-status-group" mode="authority">
    <xsl:value-of select="common:authority" />
  </xsl:template>

  <xsl:template match="common:name-status-group" mode="status">
    <xsl:choose>
      <xsl:when test="common:status/@status-code='AL'">Validly Published (Approved Lists)</xsl:when>
      <xsl:when test="common:status/@status-code='VL'">Validly Published (Validation List)</xsl:when>
      <xsl:when test="common:status/@status-code='VP'">Validly Published</xsl:when>
      <xsl:when test="common:status/@status-code='EVP'">Validly Published</xsl:when>
      <xsl:when test="common:status/@status-code='X'">Pending Curation</xsl:when>
      <xsl:when test="common:status/@status-code='CA'">Candidatus (Not Validly Published)</xsl:when>
      <xsl:otherwise>Not Validly Published</xsl:otherwise>
    </xsl:choose>
    <xsl:choose>
      <xsl:when test="common:status/@illegitimate='true'">, Illegitimate</xsl:when>
      <xsl:otherwise></xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- Generates the strain equivalencies string for a set of deposits. -->
  <xsl:template match="exemplar:identifiers" mode="strain-equivalencies">
    <xsl:choose>
      <xsl:when test="count(exemplar:identifier)=0"><xsl:value-of select="@doi" /></xsl:when>
      <xsl:otherwise>
        <xsl:for-each select="exemplar:identifier">
          <xsl:sort select="@is-laboratory-identifier" order="descending" />
          <xsl:if test="position()!=1"><xsl:text> </xsl:text></xsl:if>
          <xsl:if test="position()=2"><xsl:text>(</xsl:text></xsl:if>
          <xsl:if test="position()!=1"><xsl:text>=</xsl:text></xsl:if>
          <xsl:value-of select="@label" />
          <xsl:if test="position()!=1 and position()=last()"><xsl:text>)</xsl:text></xsl:if>
        </xsl:for-each>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  
  <!-- Generates the strain equivalencies string for a set of deposits. -->
  <xsl:template match="exemplar:identifiers" mode="strain-equivalence-links">
    <xsl:variable name="doi" select="../@doi" />
    <xsl:variable name="is-type" select="$doi=../../../common:nomenclatural-type/@nomenclatural-type-exemplar" />
    <xsl:choose>
      <xsl:when test="count(exemplar:identifier)=0">
        <xsl:call-template name="strain-link">
          <xsl:with-param name="uri" select="$doi" />
          <xsl:with-param name="identifier" select="$doi" />
        </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
        <xsl:for-each select="exemplar:identifier">
          <xsl:sort select="@is-laboratory-identifier" order="descending" />
          <xsl:if test="position()!=1"><xsl:text> </xsl:text></xsl:if>
          <xsl:if test="position()=2"><xsl:text>(</xsl:text></xsl:if>
          <xsl:if test="position()!=1"><xsl:text>=</xsl:text></xsl:if>
          <xsl:call-template name="strain-link">
            <xsl:with-param name="uri" select="$doi" />
            <xsl:with-param name="identifier" select="@label" />
          </xsl:call-template>
          <xsl:if test="position()=1 and $is-type='true'"><sup>T</sup></xsl:if>
          <xsl:if test="position()!=1 and position()=last()"><xsl:text>)</xsl:text></xsl:if>
        </xsl:for-each>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- Generates the strain equivalencies string for a set of deposits. -->
  <xsl:template match="exemplar:identifiers" mode="equivalence-links-strainfinder">
    <xsl:variable name="doi" select="../@doi" />
    <xsl:variable name="is-type" select="$doi=../../../common:nomenclatural-type/@nomenclatural-type-exemplar" />
    <xsl:choose>
      <xsl:when test="count(exemplar:identifier)=0">
        <xsl:call-template name="strain-link">
          <xsl:with-param name="uri" select="$doi" />
          <xsl:with-param name="identifier" select="$doi" />
        </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
        <xsl:for-each select="exemplar:identifier">
          <xsl:sort select="@is-laboratory-identifier" order="descending" />
          <xsl:if test="position()!=1"><xsl:text> </xsl:text></xsl:if>
          <xsl:if test="position()=2"><xsl:text>(</xsl:text></xsl:if>
          <xsl:if test="position()!=1"><xsl:text>=</xsl:text></xsl:if>
          <xsl:call-template name="strain-link">
            <xsl:with-param name="uri"><xsl:text>https://doi.org/10.1601/strainfinder?urlappend=%3fid=</xsl:text><xsl:value-of select="@label" /></xsl:with-param>
            <xsl:with-param name="identifier" select="@label" />
          </xsl:call-template>
          <xsl:if test="position()=1 and $is-type='true'"><sup>T</sup></xsl:if>
          <xsl:if test="position()!=1 and position()=last()"><xsl:text>)</xsl:text></xsl:if>
        </xsl:for-each>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- Generates the strain equivalencies string for a set of deposits. -->
  <xsl:template name="strain-link">
    <xsl:param name="identifier" />
    <xsl:param name="uri" />
    <xsl:call-template name="doi-link">
      <xsl:with-param name="doi" select="$uri" />
      <xsl:with-param name="text" select="$identifier" />
    </xsl:call-template>
  </xsl:template>

  <!-- References. Note: These are expected to be ordered. -->
  <xsl:template match="reference:bibliography" mode="bibliography">
    <div class="bibliography">
      <h1>References</h1>
      <hr class="abstract" />
      <ol>
        <xsl:for-each select="reference:reference">
          <xsl:variable name="index" select="count(preceding-sibling::*[name(current()) = name()]) + 1" />
          <li itemscope="itemscope" itemtype="http://schema.org/citation">
            <a>
              <xsl:attribute name="id"><xsl:text>c-</xsl:text><xsl:value-of select="$index" /></xsl:attribute>
            </a>
            <xsl:apply-templates select="." mode="text-citation-full" />
          </li>
        </xsl:for-each>
      </ol>
    </div>
  </xsl:template>

  <!-- Reference Citation (anchor) -->
  <xsl:template match="reference:reference" mode="citation-anchor">
    <xsl:variable name="index" select="count(preceding-sibling::*[name(current()) = name()]) + 1" />
    <xsl:text>#</xsl:text>
    <xsl:value-of select="$index" />
  </xsl:template>

  <!-- Reference Citation (superscript) -->
  <xsl:template match="reference:reference" mode="citation-superscript">
    <xsl:variable name="index" select="count(preceding-sibling::*[name(current()) = name()]) + 1" />
    <sup>
      <a class="citation">
        <xsl:attribute name="href">
          <xsl:text>#</xsl:text>
          <xsl:value-of select="$index" />
        </xsl:attribute>
        <xsl:value-of select="$index" />
      </a>
    </sup>
  </xsl:template>

  <!-- Citation of Authors -->
  <xsl:template match="reference:reference" mode="authors">
    <xsl:apply-templates select="reference:citation" mode="authors" />
  </xsl:template>

  <!-- Citation of Authors -->
  <xsl:template match="reference:citation" mode="authors">
    <xsl:apply-templates select="reference:authors" mode="author-string-authority" />
  </xsl:template>

  <!-- Citation of Authority -->
  <xsl:template match="reference:reference" mode="authority">
    <xsl:apply-templates select="reference:citation" mode="authority" />
  </xsl:template>

  <!-- Citation of Authority -->
  <xsl:template match="reference:citation" mode="authority">
    <xsl:apply-templates select="reference:authors" mode="author-string-authority" />
    <xsl:text> </xsl:text>
    <xsl:apply-templates select="reference:year" />
  </xsl:template>

  <xsl:template match="reference:authors|reference:editors" mode="author-string-authority">
    <xsl:choose>
      <xsl:when test="count(reference:person-name) = 1">
        <xsl:apply-templates select="reference:person-name[1]" mode="last" />
      </xsl:when>
      <xsl:when test="count(reference:person-name) = 2">
        <xsl:apply-templates select="reference:person-name[1]" mode="last" />
        <xsl:text> and </xsl:text>
        <xsl:apply-templates select="reference:person-name[2]" mode="last" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:apply-templates select="reference:person-name[1]" mode="last" />
        <xsl:text> </xsl:text><em>et al.</em>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
<!--
  <xsl:template match=common:annotation" mode="monograph-entry-updates">
    <tr>
      <td><div>Updates</div></td>
      <td>
        <p><xsl:apply-templates select="common:created" mode="full" /></p>
        <p><xsl:apply-templates select="common:modified" mode="full" /></p>
      </td>
    </tr>
  </xsl:template>

  <xsl:template match="common:created" mode="footnote">
    <tr>
      <td><xsl:text>This N4L record was created on </xsl:text><xsl:value-of select="@date-formatted" /><xsl:text>.</xsl:text></td>
    </tr>
  </xsl:template>
-->
  <xsl:template match="common:modified" mode="footnote">
    <tr>
      <td style="text-align: right;"><xsl:text>This information was last reviewed on </xsl:text><span itemscope="itemscope" itemtype="http://schema.org/dateModified"><xsl:value-of select="@date-formatted" /></span><xsl:text>.</xsl:text></td>
    </tr>
  </xsl:template>

  <xsl:template name="support-footnote">
    <tr>
      <td><xsl:call-template name="support" /></td>
    </tr>
  </xsl:template>

  <xsl:template name="support">
    <p>This data was maintained by NamesforLife, LLC until September 1, 2022 in cooperation with the <a target="_blank" href="http://the-icsp.org/">International Committee on Systematics of Prokaryotes (<acronym>ICSP</acronym>)</a>.</p>
    <p>The work was supported by the Office of Biological and Environmental Research of the U.S. Department of Energy under Phase I and II STTR Awards DEFG02-07ER86321 A001-A005.</p>
    <p>Special thanks to the Society for General Microbiology, the Genomes OnLine Database, and the DSMZ.</p>
  </xsl:template>

  <xsl:template name="disclaimer">
    <p>(c) 2024, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved.</p>
    <p>CLOCKSS system has permission to ingest, preserve, and serve this Archival Unit.</p>
  </xsl:template>

</xsl:stylesheet>
