<?xml version="1.0" encoding="iso-8859-1"?>

<!-- **************************************************
     XSLT processing sheet that creates an HTML listing 
     of all class attribute values found in the XML instance
     document.
            
     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="html"
  indent="no"
  encoding="iso-8859-1"
/>


<!-- create the base html file for the analysis of used templates and styles inside a document -->
<xsl:template match="/">

  <html>
    <head>
      <title>Used Templates and Manual Styles</title>
    </head>

    <body>

      <h1>The following styles are used in the document:</h1>

      <!-- paragraph styles -->
      <xsl:if test="//*[not(name()='inline')]/@class">
        <h2>Paragraph Styles:</h2>

        <ul>
          <xsl:apply-templates select="//*[not(name()='inline')]/@class">
            <xsl:sort />
          </xsl:apply-templates>
        </ul>
      </xsl:if>

      
      <!-- character styles -->
      <xsl:if test="//inline/@class">
        <h2>Character Styles:</h2>

        <ul>
          <xsl:apply-templates select="//inline/@class">
            <xsl:sort />
          </xsl:apply-templates>
        </ul>
      </xsl:if>

      <h1>The following manual styles are used in the document:</h1>

      <ul>
        <xsl:apply-templates select="//@style" />
      </ul>
         
    </body>
  </html>
 
</xsl:template>


<!-- create an li-entry for each unique class attribute -->
<xsl:template match="@class">
  <xsl:if test="not(. = preceding::*/@class)">
     <li><xsl:value-of select="." /></li>  
  </xsl:if>
</xsl:template>


<!-- create an li-entry for each unique style attribute -->
<xsl:template match="@style">
  <xsl:if test="not(. = preceding::*/@style)">
     <li><xsl:value-of select="." /></li>  
  </xsl:if>
</xsl:template>


</xsl:stylesheet>
