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


<xsl:template match="/">
  <html>
  <head>
<title><xsl:value-of select="//artheader/title"/>
(<xsl:value-of select="//artheader/subtitle"/>)
</title>

<link rel="stylesheet" type="text/css" href="/styles/docbook.css"/>
  </head>
  <body>
  <h1><xsl:value-of select="//artheader/title"/></h1>
by: <b><xsl:value-of select="//artheader/author/firstname"/>&#160;
  <xsl:value-of select="//artheader/author/surname"/></b><br />
<xsl:value-of select="//artheader/date"/><br />
 
<blockquote>
<xsl:apply-templates select="//abstract"/>
</blockquote>
<h3>Table of Contents</h3>
<ol>
<xsl:for-each select="//sect1">
<li><a href="#{position()}"><xsl:value-of select="title"/></a>
<xsl:variable name="chapter" select="position()"/>
   <xsl:for-each select="sect2">
      <br />
      <xsl:value-of select="$chapter"/>.<xsl:value-of
      select="position()"/>&#160;<a href="#{$chapter}.{position()}"><xsl:value-of
      select="title"/></a>
   </xsl:for-each>
</li></xsl:for-each>
<li><a href="#biblio">Bibliography</a></li>
</ol>

<xsl:for-each select="//sect1">
<a name="{position()}"><h2><xsl:value-of select="title"/></h2></a>
<xsl:apply-templates select="para"/>
<xsl:variable name="chapter" select="position()"/>
<xsl:for-each select="sect2">
<a name="{$chapter}.{position()}"></a><h3><xsl:value-of
select="./title"/></h3>
<xsl:apply-templates/>
</xsl:for-each>
</xsl:for-each>

<xsl:apply-templates select="//glossary"/>
<xsl:apply-templates select="//bibliography"/>
  </body>
  </html>
</xsl:template>

<xsl:template match="sect1">
<h2><xsl:value-of select="./title"/></h2>
<xsl:apply-templates/>
</xsl:template>

<xsl:template match="sect2">
<h3><xsl:value-of select="title"/></h3>
<xsl:apply-templates/>
</xsl:template>

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

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

<xsl:template match="abstract">
<p class="abstract"><i>Abstract</i> -- <xsl:apply-templates/></p>
</xsl:template>


<xsl:template match="glossary">
<a name="gloss"></a><h2>Glossary</h2>
<dl>
<xsl:apply-templates/>
</dl>
</xsl:template>

<xsl:template match="glossentry">
<dt><xsl:value-of select="glossterm"/></dt>
<dd><xsl:apply-templates select="glossdef"/></dd>
</xsl:template>

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

<xsl:template match="bibliography">
<a name="biblio"></a><h2>Bibliography</h2>
<xsl:apply-templates/>
</xsl:template>

<xsl:template match="biblioentry">
<p><a name="{@xref}"></a>
<xsl:for-each select="authorgroup/author">
<xsl:value-of select="surname"/>, <xsl:value-of select="firstname"/>, 
</xsl:for-each>
<xsl:value-of select="title"/>, <xsl:value-of
select="publisher/publishername"/> <xsl:value-of select="pagenums"/>
</p>
</xsl:template>

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

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

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

<xsl:template match="image">
<table border="0" width="{width}">
<tr><td><img src="{src}" width="{width}" height="{height}"
alt="{alt}" /></td></tr>
<tr><td class="caption"><xsl:apply-templates select="caption"/></td></tr></table>
</xsl:template>

 <!-- this has to be last because of document order nonsense -->
<xsl:output method="xml"/>
</xsl:stylesheet>

