<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
					 xmlns:h="http://www.w3.org/1999/xhtml"
     version="1.0">

  <xsl:output indent="no"/>

  <!-- Elements have id attributes added -->
  <xsl:template match="p|pre|li|h1|h2|h3|h4|table|tr | h:p|h:pre|h:li|h:h1|h:h2|h:h3|h:h4|h:table|h:tr">
    <xsl:copy>
      <xsl:if test="not(@id)">
      <xsl:attribute name="id">
        <xsl:value-of select="generate-id()"/>
        </xsl:attribute>
      </xsl:if>
      <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>
