<?xml version="1.0" encoding="iso-8859-1"?>

<!-- **************************************************
     XSLT processing sheet to remove all instances of
     the xml:lang attribute from elements.
                     
     DISCLAIMER:
       This stylesheet is provided AS IS with no warranty.
       Use completely at your own risk.
                       
     ******

     Author :  Stefan Hermann <sh@infinity-loop.de>
     Version:  1.0
     Date   :  2003-05-21
     
     ***************************************************
-->

<xsl:stylesheet 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    version="1.1" >

<xsl:output
  method="xml"
  indent="no"
  encoding="iso-8859-1"
/>

<!-- The default rule: make a copy -->
<xsl:template match="@*|node()">
  <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
  </xsl:copy>
</xsl:template>


<!-- do not copy xml:lang attributes -->
<xsl:template match="@xml:lang" />


<!-- remove inline tagging whenever the only attribute is the xml:lang attribute -->
<xsl:template match="inline">

  <xsl:choose>

    <xsl:when test="(count(@*) = 1) and @xml:lang">
        <xsl:apply-templates />
    </xsl:when>

    <xsl:otherwise>
      <xsl:copy>
        <xsl:apply-templates select="@*|node() "/>
      </xsl:copy>
    </xsl:otherwise>

  </xsl:choose>

</xsl:template>

</xsl:stylesheet>
