<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<!--
// // See license.txt for license information. // // docbook.xsl // // NOTES // Simple docbook documentation output. // // 11-Oct-2004 phamilton Created //
-->

<xsl:stylesheet xmlns:db="http://docbook.org/ns/docbook" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="html"/>
    <xsl:param name="date"/>
    <xsl:param name="copywrite"/>
    <xsl:param name="author_fullname"/>
    <xsl:param name="company"/>
    <xsl:param name="disclaimer"/>
    <xsl:param name="csspath"/>
    <xsl:template match="/db:book">
        <html>
            <head>
                <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
                <title>
                    <xsl:value-of select="db:bookinfo/db:title"/>
                </title>
                <link rel="stylesheet" type="text/css">
                    <xsl:attribute name="href">
                        <xsl:value-of select="$csspath"/>
                    </xsl:attribute>
                </link>
            </head>
            <body>
                <table width="100%" border="0" class="heading_table">
                    <tr>
                        <td width="100%">
                            <font face="Verdana, Arial, Helvetica, sans-serif">
                                <b>
                                    <font size="6">
                                        <xsl:value-of select="db:bookinfo/db:title"/>
                                    </font>
                                </b>
                            </font>
                        </td>
                    </tr>
                </table>
                <br/>
                <xsl:apply-templates select="db:chapter"/>
                <div class="generator">
Generated:                     <xsl:value-of select="$date"/>
using "xsltproc ... docbook.xsl".                     <xsl:value-of select="$copywrite"/>
;                     <xsl:value-of select="$author_fullname"/>
;                     <xsl:value-of select="$company"/>
.                     <xsl:value-of select="$disclaimer"/>
                </div>
            </body>
        </html>
    </xsl:template>
    <xsl:template match="db:chapter">
        <xsl:choose>
            <xsl:when test="db:title">
<!--
with a title, if there is an id then mark it with a name, otherwise just output the title
-->

                <h1>
                    <xsl:choose>
                        <xsl:when test="@id">
                            <a>
                                <xsl:attribute name="name">
                                    <xsl:value-of select="@id"/>
                                </xsl:attribute>
                                <xsl:value-of select="db:title"/>
                            </a>
                        </xsl:when>
                        <xsl:otherwise>
                            <xsl:value-of select="db:title"/>
                        </xsl:otherwise>
                    </xsl:choose>
                </h1>
            </xsl:when>
            <xsl:otherwise>
<!--
to title. If there is an id, then just make an empty a link
-->

                <xsl:if test="@id">
                    <a>
                        <xsl:attribute name="name">
                            <xsl:value-of select="@id"/>
                        </xsl:attribute>
                    </a>
                </xsl:if>
            </xsl:otherwise>
        </xsl:choose>
        <xsl:apply-templates select="db:para"/>
        <xsl:apply-templates select="db:table"/>
        <xsl:apply-templates select="db:sect1"/>
    </xsl:template>
    <xsl:template match="db:sect1">
        <xsl:choose>
            <xsl:when test="db:title">
<!--
with a title, if there is an id then mark it with a name, otherwise just output the title
-->

                <h2>
                    <xsl:choose>
                        <xsl:when test="@id">
                            <a>
                                <xsl:attribute name="name">
                                    <xsl:value-of select="@id"/>
                                </xsl:attribute>
                                <xsl:value-of select="db:title"/>
                            </a>
                        </xsl:when>
                        <xsl:otherwise>
                            <xsl:value-of select="db:title"/>
                        </xsl:otherwise>
                    </xsl:choose>
                </h2>
            </xsl:when>
            <xsl:otherwise>
<!--
to title. If there is an id, then just make an empty a link
-->

                <xsl:if test="@id">
                    <a>
                        <xsl:attribute name="name">
                            <xsl:value-of select="@id"/>
                        </xsl:attribute>
                    </a>
                </xsl:if>
            </xsl:otherwise>
        </xsl:choose>
        <xsl:apply-templates select="db:para"/>
        <xsl:apply-templates select="db:sect2"/>
    </xsl:template>
    <xsl:template match="db:sect2">
        <xsl:choose>
            <xsl:when test="db:title">
<!--
with a title, if there is an id then mark it with a name, otherwise just output the title
-->

                <h3>
                    <xsl:choose>
                        <xsl:when test="@id">
                            <a>
                                <xsl:attribute name="name">
                                    <xsl:value-of select="@id"/>
                                </xsl:attribute>
                                <xsl:value-of select="db:title"/>
                            </a>
                        </xsl:when>
                        <xsl:otherwise>
                            <xsl:value-of select="db:title"/>
                        </xsl:otherwise>
                    </xsl:choose>
                </h3>
            </xsl:when>
            <xsl:otherwise>
<!--
to title. If there is an id, then just make an empty a link
-->

                <xsl:if test="@id">
                    <a>
                        <xsl:attribute name="name">
                            <xsl:value-of select="@id"/>
                        </xsl:attribute>
                    </a>
                </xsl:if>
            </xsl:otherwise>
        </xsl:choose>
        <xsl:apply-templates select="db:para"/>
        <xsl:apply-templates select="db:sect3"/>
    </xsl:template>
    <xsl:template match="db:sect3">
        <xsl:choose>
            <xsl:when test="db:title">
<!--
with a title, if there is an id then mark it with a name, otherwise just output the title
-->

                <h4>
                    <xsl:choose>
                        <xsl:when test="@id">
                            <a>
                                <xsl:attribute name="name">
                                    <xsl:value-of select="@id"/>
                                </xsl:attribute>
                                <xsl:value-of select="db:title"/>
                            </a>
                        </xsl:when>
                        <xsl:otherwise>
                            <xsl:value-of select="db:title"/>
                        </xsl:otherwise>
                    </xsl:choose>
                </h4>
            </xsl:when>
            <xsl:otherwise>
<!--
to title. If there is an id, then just make an empty a link
-->

                <xsl:if test="@id">
                    <a>
                        <xsl:attribute name="name">
                            <xsl:value-of select="@id"/>
                        </xsl:attribute>
                    </a>
                </xsl:if>
            </xsl:otherwise>
        </xsl:choose>
        <xsl:apply-templates select="db:para"/>
        <xsl:apply-templates select="db:sect3"/>
    </xsl:template>
    <xsl:template match="db:para">
        <p>
            <xsl:apply-templates/>
        </p>
    </xsl:template>
    <xsl:template match="db:ulink">
        <a>
            <xsl:attribute name="href">
                <xsl:value-of select="@url"/>
            </xsl:attribute>
            <xsl:apply-templates/>
        </a>
    </xsl:template>
    <xsl:template match="db:link">
        <a>
            <xsl:attribute name="href">
#                <xsl:value-of select="@linkend"/>
            </xsl:attribute>
            <xsl:apply-templates/>
        </a>
    </xsl:template>
    <xsl:template match="db:linkend">
        <a>
            <xsl:attribute name="name">
                <xsl:value-of select="@name"/>
            </xsl:attribute>
            <xsl:apply-templates/>
        </a>
    </xsl:template>
    <xsl:template match="db:mediaobject/db:imageobject/db:imagedata">
        <img>
            <xsl:attribute name="href">
                <xsl:value-of select="@fileref"/>
            </xsl:attribute>
        </img>
    </xsl:template>
    <xsl:template match="db:programlisting">
        <code>
            <p>
                <pre>
                    <xsl:apply-templates/>
                </pre>
            </p>
        </code>
    </xsl:template>
    <xsl:template match="db:pre">
        <pre>
            <xsl:apply-templates/>
        </pre>
    </xsl:template>
    <xsl:template match="db:simplelist">
        <ul>
            <xsl:apply-templates select="db:member"/>
        </ul>
    </xsl:template>
    <xsl:template match="db:member">
        <li>
            <xsl:apply-templates/>
        </li>
    </xsl:template>
    <xsl:template match="db:table">
        <table cellpadding="5" border="1" width="100%">
            <xsl:apply-templates/>
        </table>
    </xsl:template>
    <xsl:template match="db:tbody/db:row">
        <tr>
            <xsl:apply-templates/>
        </tr>
    </xsl:template>
    <xsl:template match="db:thead/db:row">
        <thead>
            <xsl:apply-templates/>
        </thead>
    </xsl:template>
    <xsl:template match="db:thead/db:row/db:entry">
        <th>
            <xsl:apply-templates/>
        </th>
    </xsl:template>
    <xsl:template match="db:tbody/db:row/db:entry">
        <td>
            <xsl:apply-templates/>
        </td>
    </xsl:template>
    <xsl:template match="db:image">
        <img>
            <xsl:attribute name="src">
                <xsl:value-of select="@url"/>
            </xsl:attribute>
        </img>
    </xsl:template>
    <xsl:template match="db:bold">
        <b>
            <xsl:apply-templates/>
        </b>
    </xsl:template>
    <xsl:template match="db:italics">
        <i>
            <xsl:apply-templates/>
        </i>
    </xsl:template>
</xsl:stylesheet>