<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--
/////////////////////////////////////////////////////////////////////////////
//  demo.xsl - provides presentation formatting for XML-based web pages    //
//                                                                         //
//  ver 1.0 : 21 May 03                                                    //
//                                                                         //
//  Jim Fawcett, CST 2-187, Syracuse University, jfawcett@twcny.rr.com     //
/////////////////////////////////////////////////////////////////////////////
-->

<!-- Establish document structure -->
  <xsl:template match="/">
    <html>
      <head>
        <title><xsl:apply-templates select="courses/btitle"/></title>
        <xsl:apply-templates select="courses/theme"/>
        <style></style>
      </head>
      <body>
        <xsl:apply-templates select="courses/visible"/>
      </body>
    </html>
  </xsl:template>

<!-- html: Define a block of html tags -->  
  <!-- Passes HTML tags directly on to the browser without translation -->
  <xsl:template match="html">
    <xsl:copy-of select="node()"/>
  </xsl:template>

<!-- theme: Define theme's Cascading Style Sheet file -->
  <xsl:template match="theme">
    <xsl:element name="link">
      <xsl:attribute name="rel">stylesheet</xsl:attribute>
      <xsl:attribute name="href"><xsl:value-of select="@src"/></xsl:attribute>
      <xsl:attribute name="type">text/css</xsl:attribute>
    </xsl:element>
  </xsl:template>

<!-- title: Place title at top of page -->
  <xsl:template match="title">
    <h1><center><xsl:apply-templates/></center></h1>
  </xsl:template>

<!-- subtitle: Place title at top of page -->
  <xsl:template match="subtitle">
    <h1 class="subtitle"><center><xsl:apply-templates/></center></h1>
  </xsl:template>

<!-- image: Display image below title -->
  <xsl:template match="image">
    <center>
      <xsl:element name="image">
        <xsl:attribute name="src"><xsl:value-of select="@src"/></xsl:attribute>
        <xsl:attribute name="height"><xsl:value-of select="@size"/></xsl:attribute>
        <xsl:attribute name="border"></xsl:attribute>
      </xsl:element>
    </center>
  </xsl:template>

<!-- images: Display an array of images below title -->  
  <xsl:template match="images">
    <center>
      <xsl:apply-templates/>
    </center>
  </xsl:template>
  
<!-- imageItem: Place an image in array -->
  <xsl:template match="imageItem">
    <xsl:element name="image">
      <xsl:attribute name="src"><xsl:value-of select="@src"/></xsl:attribute>
      <xsl:attribute name="height"><xsl:value-of select="@size"/></xsl:attribute>
      <xsl:attribute name="border"></xsl:attribute>
    </xsl:element>
  </xsl:template>

<!-- caption: display caption below image(s) -->  
  <xsl:template match="caption">
    <center><xsl:apply-templates/></center>
    <hr/>
  </xsl:template>

<!-- revised: display revision date -->  
  <xsl:template match="revised">
    <center>
      Revised: <xsl:value-of select="." /><hr/>
    </center>
  </xsl:template>

<!-- quote: display quotation with author -->
  <xsl:template match="quote">
    <br/><center>
    &quot;<xsl:apply-templates/>&quot;<br/>
    - <xsl:value-of select="@source"/>
    </center><br/><br/>
  </xsl:template>

<!-- notice: vivid link -->
  <xsl:template match="notice">
    <xsl:element name="a">
      <xsl:attribute name="href"><xsl:value-of select="."/></xsl:attribute>
      <span class="notice"><xsl:value-of select="@title"/></span>
    </xsl:element>
  </xsl:template>
  
<!-- note: use notice font for text -->
  <xsl:template match="note">
    <span class="note">
      <xsl:apply-templates/>
    </span>
  </xsl:template>

<!-- back: button to navigate to predecessor -->
  <xsl:template match="back">
      <xsl:element name="input">
        <xsl:attribute name="type">button</xsl:attribute>
        <xsl:attribute name="value">back</xsl:attribute>
        <xsl:attribute name="onclick">history.back()</xsl:attribute>
      </xsl:element>
  </xsl:template>

<!-- constr: page construction notice -->
  <xsl:template match="constr">
    <center><h1 class="atten">
      <br/>This Page is Under Construction!<br/><br/>
    </h1></center>
  </xsl:template>
  
<!-- sconstr: site construction notice -->
  <xsl:template match="sconstr">
    <center><h1 class="atten">
      <br/>This Site is Under Construction!<br/><br/>
    </h1></center>
  </xsl:template>
  
<!-- section: Display a Section label -->
  <xsl:template match="section">
    <h2><xsl:value-of select="@title"/></h2>
    <xsl:apply-templates/>
  </xsl:template>

<!-- p: insert paragraph break -->
  <xsl:template match="p">
    <p/>
  </xsl:template>

<!-- center: create centered section -->
  <xsl:template match="center">
    <center><xsl:apply-templates/></center>
  </xsl:template>

<!-- br: insert line break -->  
  <xsl:template match="br">
    <br/>
  </xsl:template>

<!-- i: italic font -->  
  <xsl:template match="i">
    <i><xsl:apply-templates/></i>
  </xsl:template>

<!-- b: bold font -->  
  <xsl:template match="b">
    <b><xsl:apply-templates/></b>
  </xsl:template>

<!-- u: underline font -->  
  <xsl:template match="u">
    <u><xsl:apply-templates/></u>
  </xsl:template>

<!-- hr: Horizontal Rule -->  
  <xsl:template match="hr">
    <hr/>
  </xsl:template>

<!-- olist: create ordered (numbered) list -->
  <xsl:template match="olist">
    <ol>
      <xsl:apply-templates/>
    </ol>
  </xsl:template>
  
<!-- ulist: create unordered (bulleted) list -->
  <xsl:template match="ulist">
    <ul>
      <xsl:apply-templates/>
    </ul>
  </xsl:template>
  
<!-- litem: define list items for either order or unordered lists -->
  <xsl:template match="litem">
    <li><xsl:apply-templates/></li>
  </xsl:template>

<!-- llitem: labeled list item -->
  <xsl:template match="llitem">
    <li>
      <i class="emph"><xsl:value-of select="@label"/></i><br/>
      <xsl:apply-templates/>
    </li>
  </xsl:template>

<!-- block: Start indented block with background color -->
  <xsl:template match="block">
    <center><div class="block"><xsl:apply-templates/></div></center>
  </xsl:template>

<!-- hilight: Start indented block with Hilight background color -->
  <xsl:template match="hilight">
    <div class="hilight"><center><xsl:apply-templates/></center></div><hr/>
  </xsl:template>

<!-- ind: indent a block -->
  <xsl:template match="ind">
    <blockquote class="indent"><xsl:apply-templates/></blockquote>
  </xsl:template>
  
<!-- link: Define a link element - ends with line break -->
  <xsl:template match="link">
    <xsl:element name="a">
      <xsl:attribute name="href">http://<xsl:value-of select="."/></xsl:attribute>
      <xsl:value-of select="@title"/>
    </xsl:element><br/>
  </xsl:template>

<!-- sublink: Define an indented link element - ends with line break -->
  <xsl:template match="sublink">
    &#160;&#160;
    <xsl:element name="a">
      <xsl:attribute name="href">http://<xsl:value-of select="."/></xsl:attribute>
      <xsl:value-of select="@title"/>
    </xsl:element>&#32;
  </xsl:template>

<!-- ilink: Define an inline link element -->
  <xsl:template match="ilink">
    <xsl:element name="a">
      <xsl:attribute name="href">http://<xsl:value-of select="."/></xsl:attribute>
      <xsl:value-of select="@title"/>
    </xsl:element>
  </xsl:template>

<!-- file: Define a link to a file reference -->
  <xsl:template match="file">
    <xsl:element name="a">
      <xsl:attribute name="href"><xsl:value-of select="."/></xsl:attribute>
      <xsl:value-of select="@title"/>
    </xsl:element><br/>
  </xsl:template>

<!-- subfile: Define a link to a file reference -->
  <xsl:template match="subfile">
    &#160;&#160;
    <xsl:element name="a">
      <xsl:attribute name="href"><xsl:value-of select="."/></xsl:attribute>
      <xsl:value-of select="@title"/>
    </xsl:element>&#32;
  </xsl:template>

<!-- ifile: Define a link to an inline file reference -->
  <xsl:template match="ifile">
    <xsl:element name="a">
      <xsl:attribute name="href"><xsl:value-of select="."/></xsl:attribute>
      <xsl:value-of select="@title"/>
    </xsl:element>
  </xsl:template>

<!-- table: Create table -->
  <xsl:template match="table">
        <table>
          <xsl:apply-templates/>
        </table>
  </xsl:template>

<!-- th: Define heading row -->  
  <xsl:template match="th">
    <tr class="heading">
      <xsl:apply-templates/>
    </tr>
  </xsl:template>
  
<!-- tr: Define a row -->  
  <xsl:template match="tr">
    <tr class="row">
      <xsl:apply-templates/>
    </tr>
  </xsl:template>
  
<!-- hd: Define heading element -->  
  <xsl:template match="hd">
    <td class="heading"><center><xsl:apply-templates/></center></td>
  </xsl:template>
  
<!-- sd: Define a sized heading element -->
  <xsl:template match="sd">
    <td class="sized"><center><xsl:apply-templates/></center></td>
  </xsl:template>

<!-- ld: Define element of Syllabus -->  
  <xsl:template match="ld">
    <td>
      <xsl:apply-templates/>
    </td>
  </xsl:template>

<!-- ed: Define emphasized element for Syllabus -->
  <xsl:template match="ed">
    <td class="emphasis">
      <center>
        <xsl:apply-templates/>
      </center>
    </td>
  </xsl:template>

<!-- cd: Define centered element for Syllabus -->
  <xsl:template match="cd">
    <td>
      <center>
        <xsl:apply-templates/>
      </center>
    </td>
  </xsl:template>

</xsl:stylesheet>
