<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:tei="http://www.tei-c.org/ns/1.0"
                xmlns:xi="http://www.w3.org/2001/XInclude"
                xmlns:kiln="http://www.kcl.ac.uk/artshums/depts/ddh/kiln/ns/1.0"
                exclude-result-prefixes="#all"
                version="2.0">
   <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='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='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="substring-after($filename, 'Factions')"/>
               </a>
            </td>
         </xsl:template>

         <xsl:template match="str[@name='document_id']" mode="text-index">
            <td>
               <xsl:value-of select="substring-after(., 'Factions')"/>
            </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:variable name="document_type" select="'epidoc'"/>
   <xsl:variable name="match_id" select="'local-epidoc-display-html'"/>
   <xsl:template match="/">

  <!-- Type of document (name of subdirectory containing the source
       file). -->
  
  <!-- ID of sitemap map:match to use for display of individual
       texts. -->
  

  
    

  

  
    

  <!-- 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>
            
      Factions: 
      <xsl:text>Inscriptions</xsl: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">Circus Factions in the Eastern Empire</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>
                  
      
                     <xsl:text>Inscriptions</xsl:text>
    
                  </h1>
              </div>
            </div>
          
          
            <main>
              
               <div class="row">
                  <div class="large-12 columns">
          <!--<p>There are some <a href="{kiln:url-for-match('local-indices-type-display', ($language, 'epidoc'), 0)}">indices of various facets of inscription data</a> available.</p>-->

          <p>The source EpiDoc XML for all of the listed inscriptions are available in a <a href="{kiln:url-for-match('local-epidoc-zip', ($language), 0)}">ZIP archive</a>.</p>

                     <xsl:apply-templates mode="text-index" select="/aggregation/response"/>
                  </div>
               </div>
    
            </main>
          
            <!--<kiln:block name="footer">
            <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>
          </kiln:block>-->
          
      
            <!-- 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>