<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--
/////////////////////////////////////////////////////////////////////////////
//  courses.xsl - provides presentation formatting for XML-based           //
//                 course descriptions                                     //
//                                                                         //
//  ver 1.0 : 23 Dec 02                                                    //
//                                                                         //
//  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>

<!--
  <xsl:template match="theme"><xsl:value-of select="@src"/></xsl:template>
-->

<!-- btitle: Place title on browser bar -->
  <xsl:template match="btitle">
    <xsl:apply-templates/>
  </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>

<!-- lquote: display left-justified quotation with author -->
  <xsl:template match="lquote">
    <br/>
    &quot;<xsl:apply-templates/>&quot;<br/>
    - <xsl:value-of select="@source"/>
    <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: 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>
     <!--   <span class="notice"><xsl:value-of select="@title"/></span> -->
      </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>

<!-- isection: inline section label -->
  <xsl:template match="isection">
    <h2>
      <xsl:value-of select="@title"/>
      <span class="section">
        <xsl:apply-templates/>
      </span>
    </h2>
  </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>

<!-- compress: compress text -->
  <xsl:template match="compress">
    <div style="padding-top:1 px; padding-bottom:1px">
      <xsl:apply-templates/>
    </div>
  </xsl:template>

<!-- olist: create ordered (numbered) list -->
  <xsl:template match="olist">
    <ol>
      <xsl:apply-templates/>
    </ol>
  </xsl:template>
  
<!-- colist: create compressed ordered (numbered) list -->
  <xsl:template match="colist">
    <ol style="list-style:inside; margin-top:0px; margin-left:10px; margin-bottom:0px;">
      <xsl:apply-templates/>
    </ol>
  </xsl:template>
  
<!-- ulist: create unordered (bulleted) list -->
  <xsl:template match="ulist">
    <ul>
      <xsl:apply-templates/>
    </ul>
  </xsl:template>
  
<!-- culist: create compressed unordered (bulleted) list -->
  <xsl:template match="culist">
    <ul style="list-style:inside; margin-top:0px; margin-left:10px; margin-bottom:0px;">
      <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>

<!-- clitem: define compressed list items for either order or unordered lists -->
  <xsl:template match="clitem">
    <li style="padding-top:1px; padding-bottom:1px"><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">
    <div class="block"><xsl:apply-templates/></div>
  </xsl:template>

<!-- cblock: Start indented block with background color -->
  <xsl:template match="cblock">
    <div class="block"><xsl:apply-templates/></div>
  </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>
  
<!-- links: Create a block of links -->
  <xsl:template match="links">
    <blockquote class="info"><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>

<!-- syllabus: Create Syllabus table -->
  <xsl:template match="syllabus">
    <center>
      <div class="block">
        <table border="2">
          <xsl:apply-templates/>
        </table>
      </div>
    </center>
  </xsl:template>

<!-- syllHeading: Define heading row for Syllabus -->  
  <xsl:template match="syllHeading">
    <tr class="heading">
      <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>

<!-- lecture: Define a Syllabus row, e.g., a lecture -->  
  <xsl:template match="lecture">
    <tr class="row">
      <xsl:apply-templates/>
    </tr>
  </xsl:template>
  
<!-- emlecture: Define an emphasized Syllabus row -->
  <xsl:template match="emlecture">
    <tr class="emphasis">
      <xsl:apply-templates/>
    </tr>
  </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>

<!-- table: Create table -->
  <xsl:template match="table">
    <center>
      <div class="block">
        <table>
          <xsl:apply-templates/>
        </table>
      </div>
    </center>
  </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>
  
<!-- html: Define a block of html tags -->  
  <!-- Passes HTML tags directly on to the browser -->
  <xsl:template match="html">
    <xsl:copy-of select="node()"/>
  </xsl:template>

<!-- include: XML file -->
<!-- why doesn't this work???
  <xsl:template match="include">
    <xsl:apply-templates select="document(@src)"/>
  </xsl:template>
 -->
  <xsl:template match="include">
    <xsl:variable name="inc" select="document(@src)"/>
    <xsl:apply-templates select="$inc//hilight"/>
  </xsl:template>

  <xsl:template match="up2HomeNavBar">
    <div class="hilight">
      <center>
        <a href="../../WebPages/FawcettHome.xml">Home</a>&#32;
        <a href="../../WebPages/Courses.xml">Courses</a>&#32;
        <a href="../../WebPages/Code.xml">Code</a>&#32;
        <a href="http://www.ecs.syr.edu/faculty/fawcett/handouts">Handouts</a>&#32;
        <a href="../../WebPages/Books.xml">Books</a>&#32;
        <a href="../../WebPages/Mathematics.xml">Math</a>&#32;
        <a href="../../WebPages/research.xml">Research</a>&#32;
        <a href="../../WebPages/MastersProjects.xml">Masters Projects</a>&#32;
        <a href="../../WebPages/swdev.xml">SWDev</a>&#32;
        <a href="../../WebPages/webdev.xml">WebDev</a>&#32;
        <a href="../../WebPages/news.xml">News</a>&#32;
        <a href="../../WebPages/OtherLinks.xml">OtherLinks</a>&#32;
        <a href="../../WebPages/SiteDesign.xml">SiteDesign</a>&#32;
        <a href="../../WebPages/graduates.xml">Graduates</a>&#32;
        <a href="../../WebPages/AllPages.xml">AllPages</a>&#32;
        <a href="../../WebPages/OfficeHours.xml">Office Hours</a>&#32;
        <a href="../../WebPages/notices.xml"><span class="notice">Notices</span></a>&#32;
        <a href="#contents">Contents</a>&#32;
      </center>
    </div>
    <hr/>
  </xsl:template>

  <xsl:template match="up2CoursesNavBar">
    <div class="hilight">
      <center>
        <a href="../../WebPages/CSE681.xml">CSE681-SWMAA</a>&#32;
        <a href="../../WebPages/CSE686.xml">CSE686-IP</a>&#32;
        <a href="../../WebPages/CSE687.xml">CSE687-OOD</a>&#32;
        <a href="../../WebPages/CSE775.xml">CSE775-DO</a>&#32;
        <a href="../../WebPages/CSE776.xml">CSE776-DP</a>&#32;
        <a href="../../WebPages/CSE778.xml">CSE778-AWP</a>&#32;
        <a href="../../WebPages/CSE784.xml">CSE784-SWS</a>&#32;
      </center>
    </div>
    <hr/>
  </xsl:template>

  <xsl:template match="lectures10NavBar">
    <div class="hilight">
      <center>
        <a href="../lectures/CSE681.xml">CSE681-SWMAA</a>&#32;
        <a href="CSE686.xml">CSE686-IP</a>&#32;
        <a href="CSE687.xml">CSE687-OOD</a>&#32;
        <a href="CSE775.xml">CSE775-DO</a>&#32;
        <a href="CSE776.xml">CSE776-DP</a>&#32;
        <a href="CSE778.xml">CSE778-AWP</a>&#32;
        <a href="CSE784.xml">CSE784-SWS</a>&#32;
      </center>
    </div>
    <hr/>
  </xsl:template>

</xsl:stylesheet>
