<?xml version="1.0"?>
<!DOCTYPE xsl:stylesheet 
  [ <!ENTITY footer SYSTEM "footer.html">
    <!ENTITY copy "&#169;"> ]
>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:output method="html"/>

<xsl:template match='*'>
  <xsl:copy>
    <xsl:apply-templates select='node()'/>
  </xsl:copy>
</xsl:template>

<!-- The above template catches any tags for
     which we neglected to write a template match.
     Just in case. -->

<xsl:template match="course">
<HTML>
<HEAD>
<TITLE>
<xsl:value-of select="@title"/>
-- Accelerated Training from Dan Keller Technical Services
</TITLE>

<xsl:variable name="keywordlist">
  <xsl:apply-templates select="keywords" />
</xsl:variable>

<meta name="keywords" content="{$keywordlist}"></meta>

</HEAD>
<BODY>

  <table cellpadding="10" align="center">
    <tr>
      <th colspan="2" bgcolor="khaki">
        <h1><xsl:value-of select="@title" /></h1>
        <h3>Accelerated Technical Training</h3>
      </th>
    </tr>
		<xsl:apply-templates select="overview"/>
    <xsl:apply-templates select="duration"/>
    <xsl:apply-templates select="courseware"/>
    <xsl:apply-templates select="format"/>
    <xsl:apply-templates select="audience"/>
    <xsl:apply-templates select="prerequisites"/>
    <xsl:apply-templates select="contents"/>
    <xsl:apply-templates select="objectives"/>
    <xsl:apply-templates select="method"/>
    <xsl:apply-templates select="setup"/>
  </table>
  &footer;
</BODY>
</HTML>
</xsl:template>

<xsl:template match="setup">
  <tr><th bgcolor="khaki" valign="top"><h3>Setup</h3></th>
    <td bgcolor="lemonchiffon">
      Delivery of this class requires:
      <ul>
        <xsl:apply-templates select="requirement" />
        <li>Detailed system configuration instructions are
          available at <xsl:apply-templates select="url" />
        </li>
        <xsl:apply-templates select="comment" />
      </ul>
    </td>
  </tr>
</xsl:template>

<xsl:template match="method">
  <tr><th bgcolor="khaki" valign="top"><h3>Method</h3></th>
    <td bgcolor="lemonchiffon">
      <xsl:apply-templates />
    </td>
  </tr>
</xsl:template>

<xsl:template match="objectives">
  <tr><th bgcolor="khaki" valign="top"><h3>Objectives</h3></th>
    <td bgcolor="lemonchiffon">
      Upon completion of this course, you will be able to:
      <ul><xsl:apply-templates /></ul>
    </td>
  </tr>
</xsl:template>

<xsl:template match="contents">
  <tr><th bgcolor="khaki" valign="top"><h3>Contents</h3></th>
    <td bgcolor="lemonchiffon">
      <xsl:apply-templates select="h3" />
      <xsl:apply-templates select="chapter" />
      <ol>
        <xsl:apply-templates select="li" />
      </ol>
      <xsl:apply-templates select="table" />
      <xsl:apply-templates select="TABLE" />
    </td>
  </tr>
</xsl:template>

<xsl:template match="chapter">
  <p>
    <b><xsl:apply-templates select="@title" /></b>
    <ul>
      <xsl:apply-templates select="topic" />
    </ul>
  </p>
</xsl:template>

<xsl:template match="topic">
  <li>
    <xsl:apply-templates />
  </li>
</xsl:template>

<xsl:template match="prerequisite">
  <input type="checkbox" />
  <b><xsl:apply-templates select="@name" /></b>
  <xsl:apply-templates />
  <br />
</xsl:template>

<xsl:template match="prerequisites">
  <tr><th bgcolor="khaki" valign="top"><h3>Prerequisites</h3></th>
    <td bgcolor="lemonchiffon">
      Check the ones your background satisfies:
      <form>
        <xsl:apply-templates select="prerequisite" />
      </form>
      If you checked
      <xsl:apply-templates select="@minimum" />
      or more, you're well-equipped to take this class.
    </td>
  </tr>
</xsl:template>

<xsl:template match="audience">
  <tr><th bgcolor="khaki" valign="top"><h3>Audience</h3></th>
    <td bgcolor="lemonchiffon">
        <xsl:apply-templates />
    </td>
  </tr>
</xsl:template>

<xsl:template match="duration">
  <tr><th bgcolor="khaki" valign="top"><h3>Duration</h3></th>
    <td bgcolor="lemonchiffon">
      <xsl:apply-templates />
      <xsl:text> </xsl:text>
      <xsl:value-of select="@units" />
    </td>
  </tr>
</xsl:template>

<xsl:template match="description|requirement|comment|objective">
  <li><xsl:apply-templates /></li>
</xsl:template>

<xsl:template match="format">
  <tr><th bgcolor="khaki" valign="top"><h3>Format</h3></th>
    <td bgcolor="lemonchiffon">
      <ul>
        <xsl:apply-templates select="description" />
      </ul>
    </td>
  </tr>
</xsl:template>

<xsl:template match="keywords">
  <xsl:apply-templates select="keyword" />
</xsl:template>

<xsl:template match="keyword">
  <xsl:apply-templates/>
  <xsl:text>, </xsl:text>
</xsl:template>

<xsl:template match="overview">
  <tr><th bgcolor="khaki" valign="top"><h3>Overview</h3></th>
    <td bgcolor="lemonchiffon"><xsl:apply-templates select="p"/></td>
  </tr>
</xsl:template>

<xsl:template match="p">
  <p><xsl:apply-templates/></p>
</xsl:template>

<xsl:template match="courseware">
  <tr><th bgcolor="khaki" valign="top"><h3>Courseware</h3></th>
    <td bgcolor="lemonchiffon">
      <ul>
        <li>The courseware is available on the web at
          <xsl:apply-templates select="url"/>
        </li>
        <xsl:apply-templates select="description"/>
      </ul>
    </td>
  </tr>
</xsl:template>

<xsl:template match="url">
  <a href="{.}"><xsl:value-of select="." /></a>
</xsl:template>

</xsl:stylesheet>

