<?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"
                version="2.0">

  <!-- EpiDoc specific extension to stylesheets/prune-to-language.xsl. -->

  <xsl:import href="../prune-to-language.xsl">
      <xsl:stylesheet xmlns:xi="http://www.w3.org/2001/XInclude" version="2.0">

  <!-- XSLT to strip out material that is not in the supplied
       language. -->

  <xsl:param name="language"/>

         <xsl:template match="*[@xml:lang!=$language]"/>

         <xsl:template match="tei:foreign" priority="10">
            <xsl:copy>
               <xsl:apply-templates select="@*|node()"/>
            </xsl:copy>
         </xsl:template>

         <xsl:template match="@*|node()">
            <xsl:copy>
               <xsl:apply-templates select="@*|node()"/>
            </xsl:copy>
         </xsl:template>
      </xsl:stylesheet>
   </xsl:import>

  <xsl:template priority="10"
                 match="tei:div[@type='edition']|tei:div[@type='edition']//tei:div[@type='textpart']|tei:div[@type='edition']//tei:ab">
      <xsl:copy>
         <xsl:apply-templates select="@*|node()"/>
      </xsl:copy>
  </xsl:template>

  <xsl:template priority="10" match="tei:div[@type='translation']">
      <xsl:copy>
         <xsl:apply-templates select="@*|node()"/>
      </xsl:copy>
  </xsl:template>

</xsl:stylesheet>