<?xml version="1.0"?>

<!--
$Id: unexpected-test.xsl,v 1.1 2004/01/22 19:27:42 jmates Exp $

The author disclaims all copyrights and releases this document into
the public domain.

Template XSLT document to highlight elements not matched by other
xsl:template blocks. Could be used as a starting point when writing up
a stylesheet for an unfamilier document format.
-->

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

  <xsl:template match="*">
    <xsl:message>
      <xsl:text>Unmatched: </xsl:text>
      <xsl:value-of select="name()"/>

<!-- show path to element in question -->
      <xsl:text>, path=/</xsl:text>
      <xsl:for-each select="ancestor::*">
        <xsl:value-of select="name()"/>
        <xsl:if test="not(position()=last())">
          <xsl:text>/</xsl:text>
        </xsl:if>
      </xsl:for-each>
    </xsl:message>

<!-- optionally insert statements (e.g. <b style="color: red;"></b> in HTML)
for easy output display of unmatched elements -->
    <xsl:apply-templates/>

  </xsl:template>
</xsl:stylesheet>
