<?xml version="1.0" encoding="UTF-8"?>
<!--
    Copyright (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.

    CLOCKSS system has permission to ingest, preserve, and serve this Archival Unit.
    LOCKSS system has permission to collect, preserve, and serve this Archival Unit.

    This content is licensed under a Creative Commons Attribution 3.0 International license.
    https://creativecommons.org/licenses/by/3.0/
-->
<xsl:stylesheet
  version="1.0"
  xmlns:name="http://namesforlife.com/ns/name"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  >

  <xsl:output
    method="html"
    standalone="yes"
    encoding="iso-8859-1"
    omit-xml-declaration="yes"
    cdata-section-elements="pre script style"
    indent="yes"
    doctype-system="http://www.w3.org/TR/html4/strict.dtd"
    doctype-public="-//W3C//DTD HTML 4.01//EN"
    media-type="text/html"
  />

  <xsl:template match="/name:name">
    <xsl:comment>
      Copyright (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.

      CLOCKSS system has permission to ingest, preserve, and serve this Archival Unit.
      LOCKSS system has permission to collect, preserve, and serve this Archival Unit.
</xsl:comment>

    <html>
      <head>
        <link rel="icon" type="image/png" href="../images/namesforlife-icon.png"/>
        <title><xsl:text>Record: </xsl:text><xsl:value-of select="name:identifier"/> - <xsl:value-of select="name:identifier/@doi"/></title>
        <style>
BODY
{
  font-family: Verdana, Arial, sans-serif;
  font-size: 10.4px;
}
.label
{
  width: 100px;
  background-color: lightblue;
  font-weight: bold;
  text-align: right;
}
.data
{
  width: 300px;
  background-color: #DFDFDF;
  padding-left: 5px;
}
DIV.group
{
  width: 400px;
  border: 1px solid black;
  margin-top: 5px;
  margin-left: 5px;
}
IFRAME#xml
{
  width: 730px;
  height: 600px;
  border: 0px;
}
TEXTAREA.notes
{
  width: 394px;
  height: 150px;
  border: 0px;
  margin: 0px;
}
TD.notes
{
  background-color: #c0c0c0;
}
DIV#xmllinks
{
  text-align: right;
  width: 430px;
}
DIV#navlinks
{
  width: 430px;
}
A#hidexmllink
{
  display: none;
}
A#savenoteslink
{
  display: none;
  border: 1px solid red;
  background-color: #c0c0c0;
}
A
{
  display: inline;
  text-decoration: none;
}
A.navlink
{
  background-color: lightblue;
  border-top: 1px solid black;
  border-left: 1px solid black;
  border-right: 1px solid black;
}
A.navlink:hover
{
  background-color: lightyellow;
  border-top: 1px solid black;
  border-left: 1px solid black;
  border-right: 1px solid black;
}
A.navlink:visited
{
}
.label-group
{
  text-align: center;
  border-top: 1px solid black;
}
.data-authority
{
  background-color: lightyellow; /* deserves special attention */
}
.label-reference
{
  background-color: #996666;
  color: white;
}
.label-taxonomy
{
  background-color: #99cc99;
}
.label-exemplar
{
  background-color: #66cc66;
}
.label-synonym
{
  background-color: #cccc99;
}
        </style>
        <script>
function showElementById(elementId)
{
  showElement(window.content.document.getElementById(elementId));
}

function showElement(element)
{
  if (element.nodeName == 'A')
  {
    element.style.display = 'inline';
  } else {
    element.style.display = 'block';
  }
}

function hideElementById(elementId)
{
  hideElement(window.content.document.getElementById(elementId));
}

function hideElement(element)
{
  element.style.display = 'none';
}

function setPageWidth(newWidth)
{
  self.resizeTo(newWidth, 722);
}

function highlightSave()
{
  showElementById('savenoteslink');
}

function showXml()
{
  setPageWidth(1195);
  showElementById('rightpane');
  hideElementById('showxmllink');
  showElementById('hidexmllink');
}

function hideXml()
{
  setPageWidth(455);
  hideElementById('rightpane');
  hideElementById('hidexmllink');
  showElementById('showxmllink');
}
        </script>
      </head>
      <body onload="loadCuratorNotes();">
        <form>
          <input type="hidden" id="doi" name="doi">
            <xsl:attribute name="value"><xsl:value-of select="name:identifier/@doi"/></xsl:attribute>
          </input>
          <input type="hidden" id="name" name="name">
            <xsl:attribute name="value"><xsl:value-of select="name:identifier"/></xsl:attribute>
          </input>
          <table style="width: 430px; border: 0px; margin: 0px; padding: 0px;">
            <tr>
              <td>
                <a id="savenoteslink" onclick="saveCuratorNotes();">
                  <xsl:attribute name="href"><xsl:text>doi:</xsl:text><xsl:value-of select="name:identifier/@doi"/></xsl:attribute>
                  <xsl:text>save curator notes</xsl:text>
                </a>
              </td>
              <td style="width: 315px; text-align: right;"><span id="annotation-date"/><span id="annotation-by"/></td>
            </tr>
            <tr>
              <td colspan="2" style="text-align: right;"><a id="showxmllink" href="#" onclick="showXml(); return false;">Show XML &#62;&#62;</a><a id="hidexmllink" href="#" onclick="hideXml(); return false;">&#60;&#60; Hide XML</a></td>
            </tr>
          </table>
          <div id="navlinks">
            <a id="name-tab" href="#name" class="navlink">Name</a>
            <xsl:text> </xsl:text>
            <a id="events-tab" href="#events" class="navlink">Events</a>
            <xsl:text> </xsl:text>
            <a id="taxonomy-tab" href="#taxonomy" class="navlink">Taxonomy</a>
            <xsl:text> </xsl:text>
            <a id="exemplars-tab" href="#exemplars" class="navlink">Exemplars</a>
            <xsl:text> </xsl:text>
            <a id="synonyms-tab" href="#synonyms" class="navlink">Synonyms</a>
            <xsl:text> </xsl:text>
            <a id="bibliography-tab" href="#bibliography" class="navlink">Bibliography</a>
            <xsl:text> </xsl:text>
            <a id="notes-tab" href="#notes" class="navlink">Notes</a>
          </div>
          <div style="border: 1px solid black; width: 428px; height: 600px; float: left; overflow: auto;">
            <xsl:apply-templates select="name:identifier"/>
            <xsl:apply-templates select="name:events"/>
            <xsl:apply-templates select="name:taxon"/>
            <xsl:apply-templates select="name:exemplars"/>
            <xsl:apply-templates select="name:synonyms"/>
            <xsl:apply-templates select="name:bibliography"/>
            <xsl:call-template name="notes"/>
            <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
          </div>
        </form>
        <div id="rightpane" style="border: 1px solid black; width: 730px; height: 600px; float: right; display: none;">
          <iframe id="xml">
            <xsl:attribute name="src">
              <xsl:text>../</xsl:text><xsl:value-of select="name:identifier/@doi"/><xsl:text>.xml</xsl:text>
            </xsl:attribute>
          </iframe>
        </div>
      </body>
    </html>
  </xsl:template>

  <xsl:template name="curation-bar">
    <xsl:param name="id"/>
    <xsl:variable name="verified"><xsl:value-of select="$id"/><xsl:text>-verified</xsl:text></xsl:variable>
    <xsl:variable name="review"><xsl:value-of select="$id"/><xsl:text>-review</xsl:text></xsl:variable>
    <xsl:variable name="assign"><xsl:value-of select="$id"/><xsl:text>-assign</xsl:text></xsl:variable>
    <table>
      <tr>
        <td class="clean-review-check" style="text-align: left; vertical-align: middle;">
          <input type="checkbox" style="margin: 0px; vertical-align: middle;" onchange="highlightSave();">
            <xsl:attribute name="id"><xsl:value-of select="$verified"/></xsl:attribute>
            <xsl:attribute name="name"><xsl:value-of select="$verified"/></xsl:attribute>
          </input>
          <xsl:text>&#160;</xsl:text>
          <label style="vertical-align: middle;">
            <xsl:attribute name="for"><xsl:value-of select="$verified"/></xsl:attribute>
            <xsl:text>Verified</xsl:text>
          </label>
        </td>
        <td class="clean-review-check" style="text-align: left; vertical-align: middle;">
          <input type="checkbox" style="margin: 0px; vertical-align: middle;" onchange="highlightSave();">
            <xsl:attribute name="id"><xsl:value-of select="$review"/></xsl:attribute>
            <xsl:attribute name="name"><xsl:value-of select="$review"/></xsl:attribute>
          </input>
          <xsl:text>&#160;</xsl:text>
          <label style="vertical-align: middle;">
            <xsl:attribute name="for"><xsl:value-of select="$review"/></xsl:attribute>
            <xsl:text>Needs&#160;Review</xsl:text>
          </label>
        </td>
        <td class="clean-review-check" style="text-align: left; vertical-align: middle;">
          <select style="margin: 0px; vertical-align: middle; font-size: 10px;" onchange="highlightSave();">
            <xsl:attribute name="id"><xsl:value-of select="$assign"/></xsl:attribute>
            <xsl:attribute name="name"><xsl:value-of select="$assign"/></xsl:attribute>
            <option value="none">Unassigned</option>
            <option value="garrity">George</option>
            <option value="parker">Chuck</option>
            <option value="rohlfs">Doro</option>
            <option value="mannor">Kara</option>
            <option value="osier">Nicole</option>
            <option value="wigley">Sarah</option>
          </select>
        </td>
      </tr>
    </table>
  </xsl:template>

  <xsl:template name="notes">
    <div class="group">
      <a name="notes"></a>
      <table>
        <colgroup>
          <col class="label"/>
          <col class="data"/>
        </colgroup>
        <tr>
          <td class="label" colspan="2">Curator Notes</td>
        </tr>
        <tr>
          <td class="label notes" colspan="2"><textarea id="curator-notes" name="curator-notes" class="notes" onchange="highlightSave();"></textarea></td>
        </tr>
      </table>
    </div>
    <div class="group">
      <table>
        <colgroup>
          <col class="label"/>
          <col class="data"/>
        </colgroup>
        <tr>
          <td class="label" colspan="2">Public Notes</td>
        </tr>
        <tr>
          <td class="label notes" colspan="2"><textarea id="public-notes" name="public-notes" class="notes" onchange="highlightSave();"></textarea></td>
        </tr>
      </table>
    </div>
  </xsl:template>

  <xsl:template match="name:identifier">
    <xsl:choose>
      <xsl:when test="parent::name:synonym">
        <xsl:apply-templates select="." mode="generate">
          <xsl:with-param name="label">Synonym</xsl:with-param>
          <xsl:with-param name="class">label label-synonym</xsl:with-param>
        </xsl:apply-templates>
      </xsl:when>
      <xsl:when test="parent::name:parent">
        <xsl:apply-templates select="." mode="generate">
          <xsl:with-param name="label">Parent Taxon</xsl:with-param>
          <xsl:with-param name="class">label label-taxonomy</xsl:with-param>
        </xsl:apply-templates>
      </xsl:when>
      <xsl:when test="parent::name:child">
        <xsl:apply-templates select="." mode="generate">
          <xsl:with-param name="label">Child Taxon</xsl:with-param>
          <xsl:with-param name="class">label label-taxonomy</xsl:with-param>
        </xsl:apply-templates>
      </xsl:when>
      <xsl:otherwise>
        <xsl:apply-templates select="." mode="generate">
          <xsl:with-param name="label">Name/Authority</xsl:with-param>
          <xsl:with-param name="class">label</xsl:with-param>
        </xsl:apply-templates>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="name:identifier" mode="generate">
    <xsl:param name="label"/>
    <xsl:param name="class"/>
    <div class="group">
      <table>
        <colgroup>
          <col>
            <xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute>
          </col>
          <col class="data"/>
        </colgroup>
        <tr>
          <td colspan="2">
            <xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute>
            <xsl:choose>
              <xsl:when test="parent::name:name"><a name="name"><xsl:value-of select="$label"/></a></xsl:when>
              <xsl:otherwise><xsl:value-of select="$label"/></xsl:otherwise>
            </xsl:choose>
          </td>
        </tr>
        <xsl:if test="parent::name:name">
          <tr>
            <td>
              <xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute>
              <xsl:text>Curation Status: </xsl:text>
            </td>
            <td class="data">
              <xsl:call-template name="curation-bar">
                <xsl:with-param name="id">name</xsl:with-param>
              </xsl:call-template>
            </td>
          </tr>
        </xsl:if>
        <xsl:if test="parent::name:synonym">
          <tr>
            <td>
              <xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute>
              <xsl:text>Synonym Date: </xsl:text>
            </td>
            <td class="data"><xsl:value-of select="../@date"/></td>
          </tr>
        </xsl:if>
        <tr>
          <td>
            <xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute>
            <xsl:text>Name: </xsl:text>
          </td>
          <td class="data"><i><xsl:value-of select="."/></i></td>
        </tr>
        <tr>
          <td>
            <xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute>
            <xsl:text>DOI: </xsl:text>
          </td>
          <td class="data"><xsl:value-of select="@doi"/></td>
        </tr>
        <tr>
          <td>
            <xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute>
            <xsl:text>Rank: </xsl:text>
          </td>
          <td class="data"><xsl:value-of select="@rank"/></td>
        </tr>
        <xsl:if test="parent::name:name">
          <tr>
            <td>
              <xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute>
              <xsl:text>Authority: </xsl:text>
            </td>
            <td class="data data-authority"><xsl:value-of select="../name:authority"/></td>
          </tr>
          <xsl:apply-templates select="../name:status"/>
        </xsl:if>
      </table>
    </div>
  </xsl:template>

  <xsl:template match="name:status">
    <tr>
      <td class="label">Current Name: </td>
      <td class="data"><i><xsl:value-of select="@current-name"/></i></td>
    </tr>
    <tr>
      <td class="label">Is Current: </td>
      <td class="data"><xsl:value-of select="@is-current"/></td>
    </tr>
    <tr>
      <td class="label">Candidatus: </td>
      <td class="data"><xsl:value-of select="@candidatus"/></td>
    </tr>
    <tr>
      <td class="label">Illegitimate: </td>
      <td class="data"><xsl:value-of select="@illegitimate"/></td>
    </tr>
    <tr>
      <td class="label">Revived: </td>
      <td class="data"><xsl:value-of select="@revived"/></td>
    </tr>
    <tr>
      <td class="label">Status Code: </td>
      <td class="data"><xsl:value-of select="@status-code"/></td>
    </tr>
  </xsl:template>

  <xsl:template match="name:synonyms">
    <div class="group">
      <table>
        <colgroup>
          <col class="label"/>
          <col class="data"/>
        </colgroup>
        <tr>
          <td class="label label-synonym" colspan="2">
            <a name="synonyms">Synonyms</a>
          </td>
        </tr>
        <tr>
          <td class="label label-synonym">Curation Status: </td>
          <td class="data data-synonym">
            <xsl:call-template name="curation-bar">
              <xsl:with-param name="id">synonyms</xsl:with-param>
            </xsl:call-template>
          </td>
        </tr>
      </table>
    </div>
    <xsl:apply-templates select="name:synonyms-from"/>
    <xsl:apply-templates select="name:synonyms-to"/>
    <xsl:apply-templates select="../synonym-graph"/>
  </xsl:template>

  <xsl:template match="name:synonyms-from">
    <xsl:apply-templates select="name:synonym">
      <xsl:sort select="@date" data-type="text" order="ascending"/>
    </xsl:apply-templates>
  </xsl:template>
  
  <xsl:template match="name:synonyms-to">
    <xsl:apply-templates select="name:synonym">
      <xsl:sort select="@date" data-type="text" order="ascending"/>
    </xsl:apply-templates>
  </xsl:template>
  
  <xsl:template match="name:synonym">
    <xsl:apply-templates select="name:identifier"/>
  </xsl:template>

  <xsl:template match="name:synonym-graph">
    <xsl:apply-templates select="name:edge">
      <xsl:sort select="edge/reference/nlm-citation/year" data-type="text" order="ascending"/>
    </xsl:apply-templates>
  </xsl:template>

  <xsl:template match="name:edge">
    <div class="group">
      <table>
        <colgroup>
          <col class="label"/>
          <col class="data"/>
        </colgroup>
        <tr>
          <td class="label" colspan="2">Synonym Edge</td>
        </tr>
        <xsl:apply-templates/>
      </table>
    </div>
  </xsl:template>

  <xsl:template match="direction">
    <tr>
      <td class="label label-synonym label-edge label-edge-direction">Date: </td>
      <td class="data"><xsl:value-of select="@date"/></td>
    </tr>
    <tr>
      <td class="label label-synonym label-edge label-edge-direction">Type: </td>
      <td class="data"><xsl:value-of select="@type"/></td>
    </tr>
    <tr>
      <td class="label label-synonym label-edge label-edge-direction">From: </td>
      <td class="data"><xsl:value-of select="@from"/></td>
    </tr>
    <tr>
      <td class="label label-synonym label-edge label-edge-direction">To: </td>
      <td class="data"><xsl:value-of select="@to"/></td>
    </tr>
  </xsl:template>

  <xsl:template match="time">
    <tr>
      <td class="label label-synonym label-edge label-edge-time">Date: </td>
      <td class="data"><xsl:value-of select="@date"/></td>
    </tr>
    <tr>
      <td class="label label-synonym label-edge label-edge-time">Type: </td>
      <td class="data"><xsl:value-of select="@type"/></td>
    </tr>
    <tr>
      <td class="label label-synonym label-edge label-edge-time">Earlier: </td>
      <td class="data"><xsl:value-of select="@earlier"/></td>
    </tr>
    <tr>
      <td class="label label-synonym label-edge label-edge-time">Later: </td>
      <td class="data"><xsl:value-of select="@later"/></td>
    </tr>
  </xsl:template>

  <xsl:template match="taxa">
    <tr>
      <td class="label label-synonym label-edge label-edge-taxa">Date: </td>
      <td class="data"><xsl:value-of select="@date"/></td>
    </tr>
    <tr>
      <td class="label label-synonym label-edge label-edge-taxa">From: </td>
      <td class="data"><xsl:value-of select="@from"/></td>
    </tr>
    <tr>
      <td class="label label-synonym label-edge label-edge-taxa">Species: </td>
      <td class="data"><xsl:value-of select="@species"/></td>
    </tr>
    <tr>
      <td class="label label-synonym label-edge label-edge-taxa">Subspecies: </td>
      <td class="data"><xsl:value-of select="@subspecies"/></td>
    </tr>
  </xsl:template>

  <xsl:template match="name:taxon">
    <div class="group">
      <table>
        <colgroup>
          <col class="label"/>
          <col class="data"/>
        </colgroup>
        <tr>
          <td class="label label-taxonomy" colspan="2">
            <a name="taxonomy">Taxonomy</a>
          </td>
        </tr>
        <tr>
          <td class="label label-taxonomy">Curation Status: </td>
          <td class="data data-taxonomy">
            <xsl:call-template name="curation-bar">
              <xsl:with-param name="id">taxonomy</xsl:with-param>
            </xsl:call-template>
          </td>
        </tr>
      </table>
    </div>
    <xsl:apply-templates select="name:parent"/>
    <xsl:apply-templates select="name:child"/>
  </xsl:template>

  <xsl:template match="name:parent|name:child">
    <xsl:apply-templates select="name:identifier"/>
  </xsl:template>

  <xsl:template match="name:events">
    <div class="group">
      <table>
        <colgroup>
          <col class="label"/>
          <col class="data"/>
        </colgroup>
        <tr>
          <td class="label label-reference" colspan="2">
            <a name="events">Events</a>
          </td>
        </tr>
        <tr>
          <td class="label label-reference">Curation Status: </td>
          <td class="data data-references">
            <xsl:call-template name="curation-bar">
              <xsl:with-param name="id">references</xsl:with-param>
            </xsl:call-template>
          </td>
        </tr>
      </table>
    </div>
    <xsl:apply-templates select="name:event"/>
  </xsl:template>

  <xsl:template match="name:event">
    <div class="group">
      <table>
        <colgroup>
          <col class="label label-reference label-reference-effective"/>
          <col class="data"/>
        </colgroup>
        <tr>
          <td class="label label-reference label-reference-effective" colspan="2">
            <xsl:choose>
              <xsl:when test="@type='validation'">Valid Publication</xsl:when>
              <xsl:when test="@type='effective-publication'">Effective Publication</xsl:when>
              <xsl:when test="@type='judicial-opinion'">Judicial Opinion</xsl:when>
            </xsl:choose>
          </td>
        </tr>
        <xsl:if test="@type='judicial-opinion'">
          <xsl:apply-templates select="name:opinion"/>
        </xsl:if>
        <xsl:apply-templates select="/name:name/name:bibliography/name:reference[@id=current()/@reference]"/>
      </table>
    </div>
  </xsl:template>

  <xsl:template match="name:opinion">
    <tr>
      <td class="label label-reference label-reference-journal">Opinion: </td>
      <td class="data"><xsl:value-of select="."/></td>
    </tr>
    </xsl:template>

  <xsl:template match="name:bibliography">
    <div class="group">
      <table>
        <colgroup>
          <col class="label"/>
          <col class="data"/>
        </colgroup>
        <tr>
          <td class="label label-reference" colspan="2">
            <a name="bibliography">Bibliography</a>
          </td>
        </tr>
        <xsl:apply-templates select="name:reference" mode="bibliography"/>
      </table>
    </div>
  </xsl:template>

  <xsl:template match="name:reference">
    <xsl:apply-templates select="name:citation"/>
  </xsl:template>

  <xsl:template match="name:reference" mode="bibliography">
    <tr>
      <td class="label label-reference label-group" colspan="2">Reference</td>
    </tr>
    <xsl:apply-templates select="name:citation"/>
  </xsl:template>

  <xsl:template match="name:citation[@citation-type='thesis']">
      <xsl:apply-templates select="authors"/>
      <tr>
        <td class="label label-reference label-reference-journal">Thesis Title: </td>
        <td class="data"><xsl:value-of select="article-title"/></td>
      </tr>
      <tr>
        <td class="label label-reference label-reference-journal">Journal/Source: </td>
        <td class="data"><xsl:value-of select="source"/></td>
      </tr>
      <tr>
        <td class="label label-reference label-reference-journal">Year: </td>
        <td class="data"><xsl:value-of select="year"/></td>
      </tr>
      <tr>
        <td class="label label-reference label-reference-journal">Publisher: </td>
        <td class="data"><xsl:value-of select="publisher-name"/></td>
      </tr>
      <tr>
        <td class="label label-reference label-reference-journal">Publisher Type: </td>
        <td class="data"><xsl:value-of select="@publisher-type"/></td>
      </tr>
      <tr>
        <td class="label label-reference label-reference-journal">First page: </td>
        <td class="data"><xsl:value-of select="fpage"/></td>
      </tr>
      <tr>
        <td class="label label-reference label-reference-journal">Last page: </td>
        <td class="data"><xsl:value-of select="lpage"/></td>
      </tr>
  </xsl:template>

  <xsl:template match="name:citation[@citation-type='journal']">
      <xsl:apply-templates select="name:authors"/>
      <tr>
        <td class="label label-reference label-reference-journal">Article Title: </td>
        <td class="data"><xsl:value-of select="name:article-title"/></td>
      </tr>
      <tr>
        <td class="label label-reference label-reference-journal">Journal Title: </td>
        <td class="data"><xsl:value-of select="name:source"/></td>
      </tr>
      <tr>
        <td class="label label-reference label-reference-journal">Year: </td>
        <td class="data"><xsl:value-of select="name:year"/></td>
      </tr>
      <tr>
        <td class="label label-reference label-reference-journal">Volume: </td>
        <td class="data"><xsl:value-of select="name:volume"/></td>
      </tr>
      <tr>
        <td class="label label-reference label-reference-journal">First page: </td>
        <td class="data"><xsl:value-of select="name:fpage"/></td>
      </tr>
      <tr>
        <td class="label label-reference label-reference-journal">Last page: </td>
        <td class="data"><xsl:value-of select="name:lpage"/></td>
      </tr>
      <tr>
        <td class="label label-reference label-reference-journal">DOI: </td>
        <td class="data"><xsl:value-of select="name:pub-id[@pub-id-type='doi']"/>
          <xsl:if test="name:pub-id[@pub-id-type='doi']">
            <xsl:text>&#160;&#160;&#160;[</xsl:text>
            <a target="article">
              <xsl:attribute name="href"><xsl:text>http://dx.doi.org/</xsl:text><xsl:value-of select="name:pub-id[@pub-id-type='doi']"/></xsl:attribute>
              <xsl:text>link</xsl:text>
            </a>
            <xsl:text>]</xsl:text>
          </xsl:if>
        </td>
      </tr>
      <tr>
        <td class="label label-reference label-reference-journal">PubMed ID: </td>
        <td class="data"><xsl:value-of select="name:pub-id[@pub-id-type='pmid']"/>
          <xsl:if test="name:pub-id[@pub-id-type='pmid']">
            <xsl:text>&#160;&#160;&#160;[</xsl:text>
            <a target="article">
              <xsl:attribute name="href"><xsl:text>http://www.ncbi.nlm.nih.gov/pubmed/</xsl:text><xsl:value-of select="name:pub-id[@pub-id-type='pmid']"/></xsl:attribute>
              <xsl:text>link</xsl:text>
            </a>
            <xsl:text>]</xsl:text>
          </xsl:if>
        </td>
      </tr>
  </xsl:template>

  <xsl:template match="name:citation[@citation-type='book']">
    <xsl:apply-templates select="name:authors"/>
      <tr>
        <td class="label label-reference label-reference-journal">Chapter Title: </td>
        <td class="data"><xsl:value-of select="name:article-title"/></td>
      </tr>
      <tr>
        <td class="label label-reference label-reference-journal">Book: </td>
        <td class="data"><xsl:value-of select="name:source"/></td>
      </tr>
      <tr>
        <td class="label label-reference label-reference-journal">Year: </td>
        <td class="data"><xsl:value-of select="name:year"/></td>
      </tr>
      <tr>
        <td class="label label-reference label-reference-journal">Volume: </td>
        <td class="data"><xsl:value-of select="name:volume"/></td>
      </tr>
      <tr>
        <td class="label label-reference label-reference-journal">Edition: </td>
        <td class="data"><xsl:value-of select="name:edition"/></td>
      </tr>
      <tr>
        <td class="label label-reference label-reference-journal">Publisher: </td>
        <td class="data"><xsl:value-of select="name:publisher-name"/><xsl:text> (</xsl:text><xsl:value-of select="name:publisher-loc"/><xsl:text>)</xsl:text></td>
      </tr>
      <tr>
        <td class="label label-reference label-reference-journal">First page: </td>
        <td class="data"><xsl:value-of select="name:fpage"/></td>
      </tr>
      <tr>
        <td class="label label-reference label-reference-journal">Last page: </td>
        <td class="data"><xsl:value-of select="name:lpage"/></td>
      </tr>
  </xsl:template>

  <xsl:template match="name:authors">
    <xsl:for-each select="name:name">
      <tr>
        <td class="label label-reference">
          <xsl:choose>
            <xsl:when test="position()=1">
              <xsl:text>Author</xsl:text>
              <xsl:if test="position()!=last()">s</xsl:if>
              <xsl:text>: </xsl:text>
            </xsl:when>
            <xsl:otherwise>&#160;</xsl:otherwise>
          </xsl:choose>
        </td>
        <td class="data"><xsl:value-of select="name:surname"/><xsl:text> </xsl:text><xsl:value-of select="name:given-names"/><xsl:if test="name:suffix/text()"><xsl:text>, </xsl:text><xsl:value-of select="name:suffix"/></xsl:if></td>
      </tr>
    </xsl:for-each>
  </xsl:template>

  <xsl:template match="name:editors">
    <xsl:for-each select="name:name">
      <tr>
        <td class="label label-reference">
          <xsl:choose>
            <xsl:when test="position()=1">
              <xsl:text>Editor</xsl:text>
              <xsl:if test="position()!=last()">s</xsl:if>
              <xsl:text>: </xsl:text>
            </xsl:when>
            <xsl:otherwise>&#160;</xsl:otherwise>
          </xsl:choose>
        </td>
        <td class="data"><xsl:value-of select="name:surname"/><xsl:text> </xsl:text><xsl:value-of select="name:given-names"/><xsl:if test="name:suffix/text()"><xsl:text>, </xsl:text><xsl:value-of select="name:suffix"/></xsl:if></td>
      </tr>
    </xsl:for-each>
  </xsl:template>

  <xsl:template match="name:exemplars">
    <div class="group">
      <table>
        <colgroup>
          <col class="label label-exemplar"/>
          <col class="data data-exemplar"/>
        </colgroup>
        <tr>
          <td class="label label-exemplar" colspan="2">
            <a name="exemplars">Exemplars</a>
          </td>
        </tr>
        <tr>
          <td class="label label-exemplar">Curation Status: </td>
          <td class="data">
            <xsl:call-template name="curation-bar">
              <xsl:with-param name="id">exemplars</xsl:with-param>
            </xsl:call-template>
          </td>
        </tr>
      </table>
    </div>
    <xsl:apply-templates select="name:exemplar"/>
  </xsl:template>

  <xsl:template match="name:exemplar">
    <div class="group">
      <table>
        <colgroup>
          <col class="label label-exemplar"/>
          <col class="data"/>
        </colgroup>
        <tr>
          <td class="label label-exemplar" colspan="2"><xsl:if test="@is-type='true'">Type </xsl:if>Exemplar</td>
        </tr>
        <xsl:apply-templates/>
      </table>
    </div>
  </xsl:template>

  <xsl:template match="name:deposit">
    <tr>
      <td class="label label-exemplar label-deposit label-group" colspan="2">Deposit</td>
    </tr>
    <tr>
      <td class="label label-exemplar label-deposit">Identifier: </td>
      <td class="data data-exemplar"><xsl:value-of select="@id"/></td>
    </tr>
    <xsl:apply-templates select="name:feature"/>
  </xsl:template>

  <xsl:template match="name:null-strain">
    <xsl:if test="count(name:feature) &gt; 0">
      <tr>
        <td class="label label-exemplar label-deposit label-group" colspan="2">features not associated with strain</td>
      </tr>
      <xsl:apply-templates select="name:feature"/>
    </xsl:if>
  </xsl:template>

  <xsl:template match="name:feature">
    <tr>
      <td class="label label-exemplar label-feature"><xsl:value-of select="@type"/>: </td>
      <td class="data data-exemplar"><xsl:value-of select="@id"/></td>
    </tr>
  </xsl:template>

</xsl:stylesheet>
