<?xml version="1.0"?> 
<!-- tracexsl1a.xsl: Adds trace-comment generation to other stylesheets.
     Basic version, minimal information and not very safe.
     (This copy uses the xsl:element/xsl:attribute solution to
     constructing new stylesheet elements.)

     Illustration from article "STYLING STYLESHEETS TO EXTEND XSLT"
     as published on developerWorks. Copyright 2003 by Joseph Kesselman.
     Permission is granted to use, distribute, and adapt this stylesheet.
-->
<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
	>

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

  <xsl:template match="xsl:template">
    <xsl:copy>
      <xsl:apply-templates select="@*"/>
      <xsl:apply-templates select="xsl:param"/>

      <xsl:element name="xsl:text" xml:space="preserve">&#10;</xsl:element>
      <xsl:element name="xsl:comment">
         <xsl:text>[TraceXSL Begin] match="</xsl:text>
         <xsl:value-of select="@match"/>
         <xsl:text>"</xsl:text>
      </xsl:element>
      <xsl:element name="xsl:text" xml:space="preserve">&#10;</xsl:element>

      <xsl:apply-templates select="node()[not(name()='xsl:param')]"/>

      <xsl:element name="xsl:text" xml:space="preserve">&#10;</xsl:element>
      <xsl:element name="xsl:comment">
         <xsl:text>[TraceXSL END] match="</xsl:text> 
         <xsl:value-of select="@match"/>
         <xsl:text>"</xsl:text>
      </xsl:element>
      <xsl:element name="xsl:text" xml:space="preserve">&#10;</xsl:element>

    </xsl:copy>
  </xsl:template>  

</xsl:stylesheet>
