<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="html" indent="yes"/>
  
  <xsl:template match="README">

    <HTML>
      <HEAD>
        <TITLE><xsl:apply-templates select="TITLE"/></TITLE>
	<META CONTENT="AUTHOR" VALUE="{AUTHOR}"/>
      </HEAD>
      <BODY BGCOLOR="#ffffff">
        <CENTER><H1>README for <xsl:value-of select="TITLE"/></H1></CENTER>
        <xsl:apply-templates select="SECTION"/>
      </BODY>
    </HTML>
  </xsl:template>

  <xsl:template match="SECTION">
     <A NAME="{@id}"/>
     <TABLE WIDTH="100%" BGCOLOR="#00aaff" CELLSPACING="0" BORDER="0">
	<TR>
	  <TD>
            <H1><CENTER><xsl:number expr="position()" format="I"/>. <xsl:value-of select="@name"/></CENTER></H1>
          </TD>
        </TR>
     </TABLE>
     <xsl:apply-templates/>
     <A HREF="#{@id}">Top of section "<xsl:value-of select="@name"/>"</A>
   </xsl:template>

  <xsl:template match="SUBSECTION">
     <A NAME="{@id}"/>
     <H2><xsl:number select="position()"/>. <xsl:value-of select="@name"/></H2>
     <xsl:apply-templates/>
     <A HREF="#{@id}">Top of section "<xsl:value-of select="@name"/>"</A>
     <HR/>
   </xsl:template>

  <xsl:template match="SUBSUBSECTION">
     <A NAME="{@id}"/>
       <H3><xsl:number select="position()"/>. <xsl:value-of select="@name"/></H3>
     <xsl:apply-templates/>
     <A HREF="#{@id}">Top of section "<xsl:value-of select="@name"/>"</A>
   </xsl:template>

   <xsl:template match="CONTENTS">
     <OL>
       <xsl:for-each select="../../SECTION">
         <LI><A HREF="#{@id}"><xsl:value-of select="@name"/></A></LI>
       </xsl:for-each>
     </OL>
   </xsl:template>

   <xsl:template match="P">
     <P>
       <xsl:apply-templates/>
     </P>
   </xsl:template>

   <xsl:template match="STRONG">
     <STRONG>
       <xsl:apply-templates/> 
     </STRONG>
   </xsl:template>

   <xsl:template match="EM">
     <I>
       <xsl:apply-templates/>
     </I>
   </xsl:template>

   <xsl:template match="CODE">
     <CODE>
       <xsl:apply-templates/> 
     </CODE>
   </xsl:template>

   <xsl:template match="NOTE">
     <CENTER>
       <TABLE WIDTH="80%" BGCOLOR="lightyellow" BORDER="1">
         <TR>
           <TD><B>Note:</B> <xsl:apply-templates/></TD>
         </TR>
       </TABLE>
     </CENTER>
   </xsl:template>

   <xsl:template match="LIST">
     <UL>
       <xsl:apply-templates/>
     </UL>
   </xsl:template>

   <xsl:template match="NLIST">
     <OL>
       <xsl:apply-templates/>
     </OL>
   </xsl:template>

   <xsl:template match="ITEM">
     <LI><xsl:apply-templates/></LI>
   </xsl:template>

   <xsl:template match="A">
     <A HREF="{@href}"><xsl:apply-templates/></A>
   </xsl:template>

   <xsl:template match="BR">
     <BR/>
   </xsl:template>

   <xsl:template match="TABLE">
     <TABLE>
       <xsl:apply-templates/>
     </TABLE>
   </xsl:template>

   <xsl:template match="TR">
     <TR>
       <xsl:apply-templates/>
     </TR>
   </xsl:template>

   <xsl:template match="TD">
     <TD>
       <xsl:apply-templates/>
     </TD>
   </xsl:template>

</xsl:stylesheet>