<!-- Thanks to Philippe Le Hégaret -->

<xsl:transform version="1.0"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://www.w3.org/1999/xhtml"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    exclude-result-prefixes='h'>

  <xsl:output method="xml" media-type="application/xhtml+xml"
	      omit-xml-declaration='yes' encoding='iso-8859-1' indent='yes'/>

  <xsl:template match="/">
    <html>
      <xsl:copy-of select='/h:html/@*'/>      
      <xsl:copy-of select='/h:html/h:head' />      
      <xsl:apply-templates select='/h:html/h:body'/>
    </html>
  </xsl:template>

  <xsl:template match="h:h1|h:h2|h:h3|h:h4|h:h5">
    <xsl:copy-of select='.'/>
  </xsl:template>

  <xsl:template match="h:del|h:ins">
    <xsl:copy-of select='.'/>
  </xsl:template>

  <xsl:template match='h:p[.//h:del]|h:p[.//h:ins]|h:pre[.//h:del]|h:pre[.//h:ins]'>
    <xsl:copy-of select='.'/>
  </xsl:template>

  <xsl:template match='*'>
    <xsl:if test='.//h:del|.//h:ins'>
      <xsl:copy>
	<xsl:apply-templates select='@*|node()'/>
      </xsl:copy>
    </xsl:if>
  </xsl:template>

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

</xsl:transform>
