<?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/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:template match="/">

  <!-- Template for generating ePub output from a TEI source
       document. -->

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

  <!-- Import a TEI to ePub XSLT, such as that provided by the tei-xsl
       stylesheets available from http://www.tei-c.org. Due to the
       large variations in both the requirements of different
       projects, and the markup of the source TEI, Kiln does not
       provide its own XSLT for this purpose. -->
  <!--<xsl:import href="cocoon://_internal/template/xsl/stylesheets/tei/to-epub.xsl" />-->

  
    <xsl:apply-templates select="/tei:TEI"/>
  
   </xsl:template>
</xsl:stylesheet>