<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:h="http://apache.org/cocoon/request/2.0"
                xmlns:xi="http://www.w3.org/2001/XInclude"
                xmlns:kiln="http://www.kcl.ac.uk/artshums/depts/ddh/kiln/ns/1.0"
                xmlns:tei="http://www.tei-c.org/ns/1.0"
                xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
                exclude-result-prefixes="#all"
                version="2.0">
   <xsl:import href="cocoon://_internal/template/xsl/stylesheets/authority/bibliography-to-concordance-html.xsl">
      <xsl:stylesheet version="2.0">

  <!-- Convert a bibliography authority TEI document to a concordance
       index. -->

  <xsl:template match="arr[@name='concordance_bibliography_item']">
            <td>
               <ul class="inline-list">
                  <xsl:apply-templates select="str"/>
               </ul>
            </td>
         </xsl:template>

         <xsl:template match="doc" mode="item-display">
            <tr>
               <xsl:apply-templates select="str[@name='concordance_bibliography_cited_range']"/>
               <xsl:apply-templates select="arr[@name='concordance_bibliography_item']"/>
            </tr>
         </xsl:template>
  
         <xsl:template match="doc" mode="bibl-list">  
            <xsl:variable name="bibl-id" select="str[@name='concordance_bibliography_ref']"/>
            <xsl:choose>
          <!-- the following condition ensures that each bibliographic reference is displayed just once in the bibl. list -->
      <xsl:when test="str[@name='concordance_bibliography_listed']">
                  <tr>
                     <td>
                        <xsl:value-of select="str[@name='concordance_bibliography_date']"/>
                     </td>
                     <td>
                        <xsl:choose>
                           <xsl:when test="str[@name='concordance_bibliography_cited_range']">
                              <a href="{kiln:url-for-match('local-concordance-bibliography-item', ($language, $bibl-id), 0)}">
                                 <xsl:apply-templates mode="short-citation" select="id($bibl-id)"/>
                              </a>
                           </xsl:when>
                           <xsl:otherwise>
                              <xsl:apply-templates mode="short-citation" select="id($bibl-id)"/>
                           </xsl:otherwise>
                        </xsl:choose>
                        <xsl:text>: </xsl:text>
                        <xsl:apply-templates mode="full-citation" select="id($bibl-id)"/>
                     </td>
                  </tr>
               </xsl:when>
               <xsl:otherwise/>
            </xsl:choose>
         </xsl:template>

         <xsl:template match="str[@name='concordance_bibliography_cited_range']">
            <td>
               <xsl:value-of select="."/>
            </td>
         </xsl:template>

         <xsl:template match="arr[@name='concordance_bibliography_item']/str">
            <li>
               <a href="{kiln:url-for-match('local-epidoc-display-html', ($language, .), 0)}">
                  <xsl:value-of select="."/>
               </a>
            </li>
         </xsl:template>

         <xsl:template match="tei:bibl[@xml:id]" mode="full-citation">
            <xsl:apply-templates select="node() except tei:bibl[@type]"/>
            <!--<xsl:apply-templates select="tei:author" />
    <xsl:apply-templates select="tei:editor" />
    <xsl:apply-templates select="tei:date[1]" />
    <xsl:apply-templates select="tei:title[1]" />
    <xsl:apply-templates select="tei:title[2]" />-->
  </xsl:template>

         <xsl:template match="tei:bibl[@xml:id]" mode="short-citation">
            <strong>
               <xsl:choose>
                  <xsl:when test="tei:bibl[@type='abbrev']">
                     <xsl:apply-templates select="tei:bibl[@type='abbrev'][1]"/>
                  </xsl:when>
                  <xsl:otherwise>
                     <xsl:choose>
                        <xsl:when test="ancestor::tei:div[@xml:id='authored_editions']">
                           <xsl:for-each select="descendant::tei:name[@type='surname'][not(parent::*/preceding-sibling::tei:title)]">
                              <xsl:value-of select="."/>
                              <xsl:if test="position()!=last()"> – </xsl:if>
                           </xsl:for-each>
                           <xsl:if test="descendant::tei:date/text()">
                              <xsl:text> </xsl:text>
                              <xsl:value-of select="descendant::tei:date"/>
                           </xsl:if>
                        </xsl:when>
                        <xsl:when test="ancestor::tei:div[@xml:id='series_collections']">
                           <i>
                              <xsl:value-of select="@xml:id"/>
                           </i>
                        </xsl:when>
                     </xsl:choose>
                  </xsl:otherwise>
               </xsl:choose>
            </strong>
            <!--<xsl:choose>
      <xsl:when test="tei:editor">
        <xsl:value-of select="tei:editor[1]" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="tei:author[1]" />
      </xsl:otherwise>
    </xsl:choose>
    <xsl:text> </xsl:text>
    <xsl:value-of select=".//tei:date[1]" />-->
  </xsl:template>

         <xsl:template match="tei:bibl[@type='abbrev']">
            <xsl:value-of select="."/>
         </xsl:template>
  
         <xsl:template match="tei:title">
            <i>
               <xsl:value-of select="."/>
            </i>
         </xsl:template>
  
         <xsl:template match="tei:ref[@target]">
            <a target="_blank" href="{@target}">
               <xsl:value-of select="."/>
            </a>
         </xsl:template>
  
         <xsl:template match="tei:ptr[@target]">
            <xsl:choose>
               <xsl:when test="starts-with(@target, 'http')">
                  <a target="_blank" href="{@target}">
                     <xsl:value-of select="@target"/>
                  </a>
               </xsl:when>
               <xsl:otherwise>
                  <xsl:variable name="id">
                     <xsl:choose>
                        <xsl:when test="contains(@target, '#')">
                           <xsl:value-of select="substring-after(@target, '#')"/>
                        </xsl:when>
                        <xsl:otherwise>
                           <xsl:value-of select="@target"/>
                        </xsl:otherwise>
                     </xsl:choose>
                  </xsl:variable>
                  <xsl:variable name="bibl" select="ancestor::tei:TEI//tei:bibl[@xml:id=$id]"/>
                  <a target="_blank" href="../../concordance/bibliography/{$id}.html">
                     <xsl:choose>
                        <xsl:when test="$bibl">
                           <xsl:choose>
                              <xsl:when test="$bibl//tei:bibl[@type='abbrev']">
                                 <xsl:apply-templates select="$bibl//tei:bibl[@type='abbrev'][1]"/>
                              </xsl:when>
                              <xsl:otherwise>
                                 <xsl:choose>
                                    <xsl:when test="$bibl[ancestor::tei:div[@xml:id='authored_editions']]">
                                       <xsl:for-each select="$bibl//tei:name[@type='surname'][not(parent::*/preceding-sibling::tei:title)]">
                                          <xsl:value-of select="."/>
                                          <xsl:if test="position()!=last()"> – </xsl:if>
                                       </xsl:for-each>
                                       <xsl:if test="$bibl//tei:date/text()">
                                          <xsl:text> </xsl:text>
                                          <xsl:value-of select="$bibl//tei:date"/>
                                       </xsl:if>
                                    </xsl:when>
                                    <xsl:when test="$bibl[ancestor::tei:div[@xml:id='series_collections']]">
                                       <i>
                                          <xsl:value-of select="$bibl/@xml:id"/>
                                       </i>
                                    </xsl:when>
                                 </xsl:choose>
                              </xsl:otherwise>
                           </xsl:choose>
                        </xsl:when>
                        <xsl:otherwise>
                           <xsl:value-of select="upper-case(substring($id, 1, 1))"/>
                           <xsl:value-of select="substring($id, 2)"/>
                        </xsl:otherwise>
                     </xsl:choose>
                  </a>
               </xsl:otherwise>
            </xsl:choose>
         </xsl:template>
  
         <!--<xsl:template match="tei:author">
    <xsl:value-of select="." />
    <xsl:if test="following-sibling::tei:author">
      <xsl:text>,</xsl:text>
    </xsl:if>
    <xsl:text> </xsl:text>
  </xsl:template>
  
  <xsl:template match="tei:editor">
    <xsl:value-of select="." />
    <xsl:choose>
      <xsl:when test="following-sibling::tei:editor">
        <xsl:text>, </xsl:text>
      </xsl:when>
      <xsl:otherwise>
        <xsl:text> (ed</xsl:text>
        <xsl:if test="preceding-sibling::tei:editor">
          <xsl:text>s</xsl:text>
        </xsl:if>
        <xsl:text>) </xsl:text>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  
  <xsl:template match="tei:title[1]">
    <xsl:text>, </xsl:text>
    <xsl:value-of select="." />
  </xsl:template>
  
  <xsl:template match="tei:title[2]">
    <xsl:choose>
      <xsl:when test="@level='j'">
        <xsl:text>, </xsl:text>
        <xsl:value-of select="." />
      </xsl:when>
      <xsl:otherwise>
        <xsl:text>, in </xsl:text>
        <xsl:value-of select="." />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>-->

</xsl:stylesheet>
   </xsl:import>
   <xsl:import href="cocoon://_internal/template/xsl/stylesheets/text-file-list-to-html.xsl">
      <xsl:stylesheet version="2.0">

         <xsl:template match="response" mode="text-index">
            <table class="tablesorter">
               <thead>
                  <tr>
          <!-- Let us assume that all texts have a filename, ID, and
               title. -->
          <th>Filename</th>
                     <th>ID</th>
                     <th>Title</th>
                     <xsl:if test="result/doc/arr[@name='found_provenance']/str">
                        <th>Findspot</th>
                     </xsl:if>
                     <xsl:if test="result/doc/arr[@name='author']/str">
                        <th>Author</th>
                     </xsl:if>
                     <!--<xsl:if test="result/doc/arr[@name='editor']/str">
            <th>Editor</th>
          </xsl:if>-->
          <xsl:if test="result/doc/str[@name='publication_date']">
                        <th>Publication Date</th>
                     </xsl:if>
                  </tr>
               </thead>
               <tbody>
                  <xsl:apply-templates mode="text-index" select="result"/>
               </tbody>
            </table>
         </xsl:template>

         <xsl:template match="result[not(doc)]" mode="text-index">
            <p>There are no files indexed from
    webapps/ROOT/content/xml/<xsl:value-of select="$document_type"/>!
    Put some there, index them from the admin page, and this page will
    become much more interesting.</p>
         </xsl:template>

         <xsl:template match="result/doc" mode="text-index">
            <tr>
               <xsl:apply-templates mode="text-index" select="str[@name='file_path']"/>
               <xsl:apply-templates mode="text-index" select="str[@name='document_id']"/>
               <xsl:apply-templates mode="text-index" select="arr[@name='document_title']"/>
               <xsl:apply-templates mode="text-index" select="arr[@name='found_provenance']"/>
               <!--<xsl:apply-templates mode="text-index" select="arr[@name='author']" />
      <xsl:apply-templates mode="text-index" select="arr[@name='editor']" />
      <xsl:apply-templates mode="text-index" select="str[@name='publication_date']" />-->
    </tr>
         </xsl:template>

         <xsl:template match="str[@name='file_path']" mode="text-index">
            <xsl:variable name="filename" select="substring-after(., '/')"/>
            <td>
               <a href="{kiln:url-for-match($match_id, ($language, $filename), 0)}">
                  <xsl:value-of select="$filename"/>
               </a>
            </td>
         </xsl:template>

         <xsl:template match="str[@name='document_id']" mode="text-index">
            <td>
               <xsl:number value="number(substring(., 5, 2))" format="1"/>
               <xsl:text>.</xsl:text>
               <xsl:number value="number(substring(., 7, 4))" format="1"/>
            </td>
         </xsl:template>

         <xsl:template match="arr[@name='found_provenance']" mode="text-index">
            <td>
               <xsl:value-of select="string-join(str, '; ')"/>
            </td>
         </xsl:template>
  
         <xsl:template match="arr[@name='document_title']" mode="text-index">
            <td>
               <xsl:value-of select="string-join(str, '; ')"/>
            </td>
         </xsl:template>

         <xsl:template match="arr[@name='author']" mode="text-index">
            <td>
               <xsl:value-of select="string-join(str, '; ')"/>
            </td>
         </xsl:template>

         <xsl:template match="arr[@name='editor']" mode="text-index">
            <td>
               <xsl:value-of select="string-join(str, '; ')"/>
            </td>
         </xsl:template>

         <xsl:template match="str[@name='publication_date']">
            <td>
               <xsl:value-of select="."/>
            </td>
         </xsl:template>

      </xsl:stylesheet>
   </xsl:import>
   <xsl:import href="cocoon://_internal/template/xsl/stylesheets/defaults.xsl">
      <xsl:stylesheet exclude-result-prefixes="#all" version="2.0">
  <!--
      Defaults stylesheet. Defines default globals and reads
      parameters from the sitemap.
  -->

  <xsl:param name="language"/>

         <!-- Specify a mount path if you are mounting the webapp in a
       subdirectory rather than at the root of the domain. This path
       must either be empty or begin with a "/" and not include a
       trailing slash.

       The value is the URL root for the webapp. -->
  <xsl:variable name="kiln:mount-path" select="''"/>

         <!-- $kiln:context-path defines the URL root for the webapp. -->
  <xsl:variable name="kiln:context-path">
            <xsl:value-of select="$kiln:mount-path"/>
         </xsl:variable>

         <!-- Base URL for non-textual content (images, video, etc). If these
       are being served by Cocoon, this should be specified as
       relative to $context-path. Otherwise, a full URL including
       protocol and domain is required.

       This URL must not include a trailing slash. -->
  <xsl:variable name="kiln:content-url" select="''"/>
         <xsl:variable name="kiln:content-path">
            <xsl:if test="not(starts-with($kiln:content-url, 'http'))">
               <xsl:value-of select="$kiln:mount-path"/>
            </xsl:if>
            <xsl:value-of select="$kiln:content-url"/>
         </xsl:variable>

         <!-- Base URL for assets (non-content images, CSS, JavaScript,
       etc). If these are being served by Cocoon, this should be
       specified as relative to $context-path. Otherwise, a full URL
       including protocol and domain is required.

       This URL must not include a trailing slash. -->
  <xsl:variable name="kiln:assets-url" select="'/assets'"/>
         <xsl:variable name="kiln:assets-path">
            <xsl:if test="not(starts-with($kiln:assets-url, 'http'))">
               <xsl:value-of select="$kiln:mount-path"/>
            </xsl:if>
            <xsl:value-of select="$kiln:assets-url"/>
         </xsl:variable>

         <!-- Base URL for content images. -->
  <xsl:variable name="kiln:images-url" select="concat($kiln:content-path, '/images')"/>
         <xsl:variable name="kiln:images-path">
            <xsl:if test="not(starts-with($kiln:images-url, 'http'))">
               <xsl:value-of select="$kiln:mount-path"/>
            </xsl:if>
            <xsl:value-of select="$kiln:images-url"/>
         </xsl:variable>

      </xsl:stylesheet>
   </xsl:import>
   <xsl:import href="cocoon://_internal/template/xsl/stylesheets/menu/menu.xsl">
      <xsl:stylesheet exclude-result-prefixes="#all" version="2.0">

         <xsl:template match="kiln:nav" mode="main-menu">
            <xsl:apply-templates mode="main-menu"/>
         </xsl:template>

         <xsl:template match="ul[@type='menu']" mode="main-menu">
            <xsl:apply-templates mode="main-menu"/>
         </xsl:template>

         <xsl:template match="ul[@type='breadcrumbs']" mode="main-menu"/>

         <xsl:template match="li[ul]" mode="main-menu">
            <xsl:copy>
               <xsl:apply-templates mode="main-menu" select="@*"/>
               <xsl:call-template name="add-class">
                  <xsl:with-param name="class" select="'has-dropdown'"/>
               </xsl:call-template>
               <xsl:apply-templates mode="main-menu"/>
            </xsl:copy>
         </xsl:template>

         <xsl:template match="li/ul" mode="main-menu">
            <xsl:copy>
               <xsl:apply-templates mode="main-menu" select="@*"/>
               <xsl:call-template name="add-class">
                  <xsl:with-param name="class" select="'dropdown'"/>
               </xsl:call-template>
               <xsl:apply-templates mode="main-menu"/>
            </xsl:copy>
         </xsl:template>

         <!-- For the local menu, display only the siblings of the active
       item. -->
  <xsl:template match="kiln:nav" mode="local-menu">
            <xsl:apply-templates mode="local-menu" select="ul[@type='menu']//ul[li/@class='active']/li"/>
         </xsl:template>

         <xsl:template match="li/ul" mode="local-menu"/>

         <xsl:template match="ul/@type" mode="main-menu"/>
         <xsl:template match="@*|node()" mode="main-menu">
            <xsl:copy>
               <xsl:apply-templates mode="main-menu" select="@*|node()"/>
            </xsl:copy>
         </xsl:template>
         <xsl:template match="ul/@type" mode="local-menu"/>
         <xsl:template match="@*|node()" mode="local-menu">
            <xsl:copy>
               <xsl:apply-templates mode="local-menu" select="@*|node()"/>
            </xsl:copy>
         </xsl:template>

         <xsl:template name="add-class">
            <xsl:param name="class"/>
            <xsl:attribute name="class">
               <xsl:if test="@class">
                  <xsl:value-of select="@class"/>
                  <xsl:text> </xsl:text>
               </xsl:if>
               <xsl:value-of select="$class"/>
            </xsl:attribute>
         </xsl:template>

      </xsl:stylesheet>
   </xsl:import>
   <xsl:import href="cocoon://_internal/url/reverse.xsl">
      <xsl:stylesheet xmlns:xs="http://www.w3.org/2001/XMLSchema"
                      xmlns:map="http://apache.org/cocoon/sitemap/1.0"
                      exclude-result-prefixes="#all"
                      version="2.0">
         <xsl:function name="kiln:url-for-match" as="xs:string">
            <xsl:param name="match-id" as="xs:string"/>
            <xsl:param name="parameters"/>
            <xsl:param name="cocoon-context"/>
            <xsl:variable name="url">
               <xsl:choose>
                  <xsl:when test="$match-id = 'kiln-introspection-match-url'">
                     <xsl:text>cocoon://</xsl:text>
                     <xsl:text>_internal/introspection/url/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-rdf-harvest-all-display'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/rdf/harvest/all.html</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-rdf-harvest-all'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/rdf/harvest/all.xml</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-rdf-harvest-display'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/rdf/harvest/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>.html</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-rdf-harvest'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/rdf/harvest/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>.xml</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-rdf-query'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/rdf/query/graph/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>.xml</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-rdf-generate-authority'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/rdf/generate/authority/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>.xml</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-rdf-generate-epidoc'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/rdf/generate/epidoc/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>.xml</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-rdf-generate-index'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/rdf/generate/indices/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>.xml</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-rdf-generate-tei'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/rdf/generate/tei/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>.xml</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-rdf-generate-static'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/rdf/generate/rdf/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>.xml</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-rdf-query-from-file'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/rdf/construct/graph/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>.xml</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-solr-site-list'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/solr/index/site-list.html</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-solr-index-all'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/solr/index/all.html</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-solr-index-indices'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/solr/index/indices/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>.html</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-solr-index'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/solr/index/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>/</xsl:text>
                     <xsl:value-of select="$parameters[3-1]"/>
                     <xsl:text>.html</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-solr-add-all-indices'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/solr/add/indices/</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-solr-add-all'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/solr/add/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>/</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-solr-add-tei-eats'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/solr/add/tei-eats/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>.xml</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-solr-add-tei-eats-authority'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/solr/add/tei-eats-authority/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>/</xsl:text>
                     <xsl:value-of select="$parameters[3-1]"/>
                     <xsl:text>.xml</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-solr-add-indices'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/solr/add/indices/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>.xml</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-solr-add-index'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/solr/add/indices/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>/</xsl:text>
                     <xsl:value-of select="$parameters[3-1]"/>
                     <xsl:text>.xml</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-solr-add-bibliographic-concordance'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/solr/add/concordance/authority/bibliography.xml</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-solr-add'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/solr/add/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>/</xsl:text>
                     <xsl:value-of select="$parameters[3-1]"/>
                     <xsl:text>.xml</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-solr-preprocess-tei-eats'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/solr/preprocess/tei-eats/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>.xml</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-solr-preprocess-eatsml'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/solr/preprocess/eatsml/entities.xml</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-solr-preprocess-eatsml-authority'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/solr/preprocess/eatsml/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>/entities.xml</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-solr-preprocess'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/solr/preprocess/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>/</xsl:text>
                     <xsl:value-of select="$parameters[3-1]"/>
                     <xsl:text>.xml</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-admin-home-page'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-admin-system-status'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/system-status.html</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-admin-introspection-index'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/introspection/</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-admin-introspection-match'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/introspection/match/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>.html</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-admin-introspection-template-empty'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/introspection/template/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>.html</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-admin-introspection-template-xslt'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/introspection/template/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>.xsl</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-admin-introspection-xslt'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/introspection/xslt/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>.xsl</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-admin-introspection-match-url'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/introspection/url/</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-admin-schematron-validation'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/schematron/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>.html</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-admin-resource-check'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>admin/resource-check/images/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>.html</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-admin-image-resource-check'">
                     <xsl:text>cocoon://</xsl:text>
                     <xsl:text>admin/resource-check/images/tei/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>.xml</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-admin-image-reference-check'">
                     <xsl:text>cocoon://</xsl:text>
                     <xsl:text>admin/resource-check/image-refs/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>.xml</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-admin-image-file-check'">
                     <xsl:text>cocoon://</xsl:text>
                     <xsl:text>admin/resource-check/image-files.xml</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-preprocess-tei-no-language'">
                     <xsl:text>cocoon://</xsl:text>
                     <xsl:text>internal/tei/preprocess/no-language/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>.xml</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-preprocess-epidoc-no-language'">
                     <xsl:text>cocoon://</xsl:text>
                     <xsl:text>internal/epidoc/preprocess/no-language/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>.xml</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-preprocess-tei-language'">
                     <xsl:text>cocoon://</xsl:text>
                     <xsl:text>internal/tei/preprocess/language/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>/</xsl:text>
                     <xsl:value-of select="$parameters[3-1]"/>
                     <xsl:text>.xml</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-preprocess-epidoc-language'">
                     <xsl:text>cocoon://</xsl:text>
                     <xsl:text>internal/epidoc/preprocess/language/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>/</xsl:text>
                     <xsl:value-of select="$parameters[3-1]"/>
                     <xsl:text>.xml</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-preprocess-authority-language'">
                     <xsl:text>cocoon://</xsl:text>
                     <xsl:text>internal/authority/preprocess/language/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>/</xsl:text>
                     <xsl:value-of select="$parameters[3-1]"/>
                     <xsl:text>.xml</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-epidoc-custom-html'">
                     <xsl:text>cocoon://</xsl:text>
                     <xsl:text>internal/epidoc/custom/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>/</xsl:text>
                     <xsl:value-of select="$parameters[3-1]"/>
                     <xsl:text>.html</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-search-query'">
                     <xsl:text>cocoon://</xsl:text>
                     <xsl:text>internal/search/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>.xml</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-index-extract'">
                     <xsl:text>cocoon://</xsl:text>
                     <xsl:text>internal/index/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>/</xsl:text>
                     <xsl:value-of select="$parameters[3-1]"/>
                     <xsl:text>.xml</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-typed-metadata'">
                     <xsl:text>cocoon://</xsl:text>
                     <xsl:text>internal/metadata/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>/</xsl:text>
                     <xsl:value-of select="$parameters[3-1]"/>
                     <xsl:text>.xml</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-metadata'">
                     <xsl:text>cocoon://</xsl:text>
                     <xsl:text>internal/metadata/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>.xml</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-images-gif'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>images/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>.gif</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-images-jpeg-thumbnail'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>images/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>-thumb.jpg</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-images-jpeg'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>images/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>.jpg</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-images-png'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>images/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>.png</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-home-page'">
                     <xsl:text>/</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-language-home-page'">
                     <xsl:text>/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>/</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-search'">
                     <xsl:text>/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>/search/</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-tei-index-display'">
                     <xsl:text>/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>/texts/</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-tei-display-html'">
                     <xsl:text>/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>/texts/</xsl:text>
                     <xsl:value-of select="$parameters[3-1]"/>
                     <xsl:text>.html</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-tei-display-xml'">
                     <xsl:text>/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>/texts/</xsl:text>
                     <xsl:value-of select="$parameters[3-1]"/>
                     <xsl:text>.xml</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-tei-display-pdf'">
                     <xsl:text>/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>/texts/</xsl:text>
                     <xsl:value-of select="$parameters[3-1]"/>
                     <xsl:text>.pdf</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-tei-display-epub'">
                     <xsl:text>/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>/texts/</xsl:text>
                     <xsl:value-of select="$parameters[3-1]"/>
                     <xsl:text>.epub</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-epidoc-index-display'">
                     <xsl:text>/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>/inscriptions/</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-epidoc-zip'">
                     <xsl:text>/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>/inscriptions/zip/</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-epidoc-display-html'">
                     <xsl:text>/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>/inscriptions/</xsl:text>
                     <xsl:value-of select="$parameters[3-1]"/>
                     <xsl:text>.html</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-epidoc-display-xml'">
                     <xsl:text>/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>/inscriptions/</xsl:text>
                     <xsl:value-of select="$parameters[3-1]"/>
                     <xsl:text>.xml</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-indices-type-display'">
                     <xsl:text>/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>/indices/</xsl:text>
                     <xsl:value-of select="$parameters[3-1]"/>
                     <xsl:text>/</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-index-display-html'">
                     <xsl:text>/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>/indices/</xsl:text>
                     <xsl:value-of select="$parameters[3-1]"/>
                     <xsl:text>/</xsl:text>
                     <xsl:value-of select="$parameters[4-1]"/>
                     <xsl:text>.html</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-concordance-bibliography'">
                     <xsl:text>/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>/concordances/bibliography/</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-concordance-bibliography-item'">
                     <xsl:text>/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>/concordance/bibliography/</xsl:text>
                     <xsl:value-of select="$parameters[3-1]"/>
                     <xsl:text>.html</xsl:text>
                  </xsl:when>
                  <xsl:when test="$match-id = 'local-tei-backend-xml'">
                     <xsl:text>/</xsl:text>
                     <xsl:text>text/</xsl:text>
                     <xsl:value-of select="$parameters[2-1]"/>
                     <xsl:text>.xml</xsl:text>
                  </xsl:when>
               </xsl:choose>
            </xsl:variable>
            <xsl:variable name="full-url">
               <xsl:if test="$cocoon-context and not(starts-with($url, 'cocoon://'))">cocoon:/</xsl:if>
               <xsl:value-of select="$url"/>
            </xsl:variable>
            <xsl:value-of select="$full-url"/>
         </xsl:function>
      </xsl:stylesheet>
   </xsl:import>
   <xsl:template match="/">

  <!-- Imports stylesheet to convert Solr results and bibliography
       authority TEI into HTML. -->
  

  
    

  

  
    

  <!-- Imports the default variables. -->
  

  <!-- Imports the menu stylesheet -->
  

  

  
    <html class="no-js">
      
        <head>
            <meta charset="utf-8"/>
            <meta content="width=device-width" name="viewport"/>
            <meta content="IE=edge,chrome=IE8" http-equiv="X-UA-Compatible"/>
            <title>
            
      IAph: 
      <i18n:text i18n:key="menu-concordance-bibliography">Bibliographic Concordance</i18n:text>
    
            </title>
          
      
            <link href="{$kiln:assets-path}/foundation/css/normalize.css" rel="stylesheet"
                  type="text/css"/>
            <link href="{$kiln:assets-path}/foundation/css/foundation.min.css" rel="stylesheet"
                  type="text/css"/>
            <link href="{$kiln:assets-path}/styles/base.css" rel="stylesheet" type="text/css"/>
            <link href="{$kiln:assets-path}/styles/site.css" rel="stylesheet" type="text/css"/>
            <link href="{$kiln:assets-path}/images/favicon.png" rel="shortcut icon"
                  type="image/png"/>
            <!-- <link href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css" integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A==" crossorigin="" rel="stylesheet" type="text/css" />
            <link href="{$kiln:assets-path}/styles/Control.Geocoder.css" rel="stylesheet" type="text/css" />
            <link href="{$kiln:assets-path}/styles/leaflet.fullscreen.css" rel="stylesheet" type="text/css" />-->
          
      <link href="{$kiln:assets-path}/styles/tablesorter.css" rel="stylesheet"/>
    
          
            <script src="{$kiln:assets-path}/foundation/js/vendor/custom.modernizr.js"> </script>
            <script src="{$kiln:assets-path}/scripts/cookieinfo.min.js" type="text/javascript"
                    id="cookieinfo"/>
            <!-- <script src="{$kiln:assets-path}/foundation/js/vendor/jquery.js"></script>
            <script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js" integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA==" crossorigin=""></script>
            <script src="{$kiln:assets-path}/scripts/leaflet-providers.js"></script> -->
          
          
        </head>
      
      
        <body>
          
            <div id="site-heading">
              <h1 id="site-title">Inscriptions of Aphrodisias 2027</h1>
            </div>
            <nav class="top-bar">
              
                <ul class="title-area">
                  <li class="name">
                    <h1 id="home">
                        <a href="{kiln:url-for-match('local-language-home-page', ($language), 0)}">Home</a>
                     </h1>
                  </li>
                  <li class="toggle-topbar menu-icon">
                    <a href="#">
                        <span>Menu</span>
                     </a>
                  </li>
                </ul>
                <section class="top-bar-section">
                  <ul class="left">
                    <xsl:apply-templates mode="main-menu" select="/aggregation/kiln:nav"/>
                  </ul>
                  <!--<ul class="right">
                    <li class="has-form search">
                      <form action="{kiln:url-for-match('local-search', ($language), 0)}" method="get">
                        <input name="q" placeholder="Search" required="required" type="search" />
                      </form>
                    </li>
                  </ul>-->
                </section>
              
            </nav>
          
          
            <div class="row">
              <div class="large-12 columns">
                  <h1>
                  
      
                     <i18n:text i18n:key="menu-concordance-bibliography">Bibliographic Concordance</i18n:text>
    
                  </h1>
              </div>
            </div>
          
          
            <main>
              
               <div class="row">
                  <div class="large-12 columns">
                     <table class="tablesorter">
                        <thead>
                           <tr>
                              <th scope="col">Date</th>
                              <th scope="col">Bibliographic reference</th>
                           </tr>
                        </thead>
                        <tbody>
                           <xsl:apply-templates mode="bibl-list" select="/aggregation/response/result/doc">
                              <xsl:sort select="str[@name='concordance_bibliography_short']"/>
                           </xsl:apply-templates>
                        </tbody>
                     </table>
                  </div>
               </div>
    
            </main>
          
          
            <footer>
              <p>Powered by <a href="http://kcl-ddh.github.io/kiln/">Kiln</a>/<a href="https://github.com/EpiDoc/EFES">EFES</a>. Theme by <a href="http://foundation.zurb.com/">Foundation</a>.</p>
            </footer>
          
          
      
            <!-- Since we make use of jQuery for other purposes, there
                 is no reason to use Foundation's check whether to use
                 jQuery or Zepto. -->
            <script src="{$kiln:assets-path}/foundation/js/vendor/jquery.js"/>
            <script src="{$kiln:assets-path}/foundation/js/foundation.min.js"/>
            <script>$(document).foundation();</script>
          
            <script src="{$kiln:assets-path}/scripts/jquery.tablesorter.js"/>
            <script>
               <xsl:text>$(document).ready(function() {$(".tablesorter").tablesorter();});</xsl:text>
            </script>
    
        </body>
      
      </html>
  

  

  

  

  

   </xsl:template>
</xsl:stylesheet>