Reflowed and split cscweb.xsl into smaller xsl files.
authorDavid Bartley <dtbartle@csclub.uwaterloo.ca>
Tue, 17 Jul 2007 02:27:55 +0000 (22:27 -0400)
committerDavid Bartley <dtbartle@csclub.uwaterloo.ca>
Tue, 17 Jul 2007 02:59:28 +0000 (22:59 -0400)
12 files changed:
cscweb.xsl
default.css
directory.xml
xsl/books.xsl [new file with mode: 0644]
xsl/common.xsl [new file with mode: 0644]
xsl/directory.xsl [new file with mode: 0644]
xsl/events.xsl [new file with mode: 0644]
xsl/exec.xsl [new file with mode: 0644]
xsl/media.xsl [new file with mode: 0644]
xsl/members.xsl [new file with mode: 0644]
xsl/menu.xsl [new file with mode: 0644]
xsl/news.xsl [new file with mode: 0644]

index e0f3a1c..55528f3 100644 (file)
@@ -1,9 +1,8 @@
 <?xml version='1.0'?>
 
-<xsl:stylesheet version="1.1"
-                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-               xmlns:csc="http://www.csclub.uwaterloo.ca/cow"
-               extension-element-prefixes="csc">
+<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:csc="http://www.csclub.uwaterloo.ca/cow" 
+    extension-element-prefixes="csc">
 
 <!--
 
 -->
 <xsl:variable name="pre">
  <xsl:choose>
-  <xsl:when test="/cscpage/@pre"><xsl:value-of select="/cscpage/@pre"/></xsl:when>
+  <xsl:when test="/cscpage/@pre"><xsl:value-of select="/cscpage/@pre" /></xsl:when>
   <xsl:otherwise>../</xsl:otherwise>
  </xsl:choose>
 </xsl:variable>
 
 <xsl:output method="xml" encoding="ISO-8859-1" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" />
 
-<xsl:template match="cscpage">
-
-<html>
-<head>
- <title><xsl:value-of select="@title"/></title>
-  <link rel="stylesheet" href="{$pre}default.css" type="text/css" />
-</head>
-<body>
-<div>
-<a name="pagetop" id="pagetop" />
-<xsl:apply-templates select="biglogo"/>
-<xsl:apply-templates select="header">
-<xsl:with-param name="title" select="@title"/>
-</xsl:apply-templates>
-<xsl:apply-templates select="section|menu"/>
-<xsl:apply-templates select="footer"/>
-</div>
-</body>
-</html>
-</xsl:template>
-
-<xsl:template match="section">
- <xsl:if test="@id != ''"><a id="{@id}" /></xsl:if>
- <h2><xsl:value-of select="@title"/></h2>
- <xsl:apply-templates />
-</xsl:template>
-
-<xsl:template match="biglogo" name="biglogo">
-<div class="biglogo">
-  <table cellspacing="0" cellpadding="0" border="0">
-   <tr>
-    <td><a href="http://www.uwaterloo.ca/"><img
-    src="{$pre}logos/uw_logo_100_68.gif" alt="University of Waterloo"
-    width="100" height="68" /></a></td>
-    <!--<td width="174"><a href="{$pre}"><img src="{$pre}logos/csc_160_70.png"
-    alt="Computer Science Club" width="165" height="75" align="center"
-    border="0" /></a></td>-->
-    <td><a href="http://www.acm.org"><img width="82"
-    height="103" src="{$pre}logos/acm_logo.gif" alt="A Student Chapter of
-    the ACM" /></a></td>
-   </tr>
-  </table>
-</div>
-</xsl:template>
-
-<xsl:template match="mediafile">
-       <xsl:param name="ext" />
-       <a href="/files/{@file}{$ext}"><xsl:value-of select="@type" /></a>, 
-</xsl:template>
-
-<xsl:template match="flvfile">
-  <script type="text/javascript" src="flash/swfobject.js"></script>
-  <p id="player1"><a href="http://www.macromedia.com/go/getflashplayer">
-    Get the Flash Player</a> to see this video using Flash Player.
-  </p>
-  <script type="text/javascript">
-    var s1 = new SWFObject("flash/flvplayer.swf","single","400","300","7");
-    s1.addParam("allowfullscreen","true");
-    s1.addVariable("file","http://csclub.uwaterloo.ca/files/<xsl:value-of select="@file" />");
-    <xsl:if test="@preview">
-    s1.addVariable("image","http://csclub.uwaterloo.ca/files/<xsl:value-of select="@preview" />");
-    </xsl:if>
-    s1.write("player1");
-  </script>
-</xsl:template>
-
-<xsl:template match="mediaitem">
-        <xsl:document method="xml" encoding="ISO-8859-1" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
-  href="{translate(concat($root, '/media/', @title , '.html'), ' ', ' ')}">
-<html>
-<head>
- <title><xsl:value-of select="@title"/></title>
-  <link rel="stylesheet" href="{$pre}default.css" type="text/css" />
-</head>
-<body>
-<div>
- <xsl:call-template name="header">
-  <xsl:with-param name="title" select="@title"/>
- </xsl:call-template>
-
- <xsl:if test="abstract">
- <h2>Abstract</h2>
- <div>
-  <xsl:apply-templates select="abstract/node()"/>
- </div>
- </xsl:if>
-
- <xsl:if test="flvfile">
- <h2>View</h2>
- <div>
-  <xsl:apply-templates select="flvfile">
-  </xsl:apply-templates>
- </div>
- </xsl:if>
-
- <xsl:if test="mediafile">
- <h2>Download</h2>
- <div><strong>
-  HTTP (web browser):
-  <xsl:apply-templates select="mediafile">
-   <xsl:with-param name="ext"></xsl:with-param>
-  </xsl:apply-templates>
-  <br/><br/>
-  BitTorrent:
-  <xsl:apply-templates select="mediafile" >
-   <xsl:with-param name="ext">.torrent</xsl:with-param>
-  </xsl:apply-templates>
- </strong></div>
- </xsl:if>
- <br/>
-
- <!-- AddThis Bookmark Button -->
- <script type="text/javascript">
-   addthis_url    = location.href;
-   addthis_title  = document.title;
-   addthis_pub    = 'calumt';
- </script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
-
- <xsl:if test="@buttons">
-
-  <br/><br/>
-  <!-- digg button -->
-  <script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
-
-  <!-- reddit button -->
-  <script type="text/javascript" src="http://reddit.com/button.js?t=3"></script>
-
- </xsl:if>
-
- <!-- google ads -->
- <!--
- <script type="text/javascript">
- google_ad_client = "pub-5235744946475097";
- google_ad_width = 728;
- google_ad_height = 90;
- google_ad_format = "728x90_as";
- google_ad_type = "text_image";
- //2007-03-21: mcc
- google_ad_channel = "1106187834";
- </script>
- <script type="text/javascript"
-   src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
- </script>
- -->
-
- <xsl:call-template name="footer"/>
-</div>
-</body>
-</html>
- </xsl:document>
-       <li><a href= "{@title}.html"><xsl:value-of select="@title" /></a></li>
-</xsl:template>
-
-<xsl:template match="menuitem">
- <xsl:variable name="pre2">
-  <xsl:choose>
-   <xsl:when test="@absolute = 'true'"></xsl:when>
-   <xsl:otherwise><xsl:value-of select="$pre"/></xsl:otherwise>
-  </xsl:choose>
- </xsl:variable>
-
-  <td class="menuitem">
-   <a href="{$pre2}{@href}"><img src="{$pre}buttons/{@icon}.png"
-     width="40" height="40" alt="{@title}" /><!--</a>--><br />
-   <!--<a href="{$pre2}{@href}">--><xsl:value-of select="@title"/></a>
-  </td>
-</xsl:template>
-
-<xsl:template match="menudefs">
- <div class="menuspace">
- <table cellspacing="0" cellpadding="0" border="0" class="menubar">
-  <tr>
-   <xsl:apply-templates select="menuitem"/>
-  </tr>
- </table>
- </div>
-</xsl:template>
-
-<xsl:template match="menu" name="menu">
- <xsl:apply-templates select="document('menu.xml')/menudefs"/>
-</xsl:template>
-
-<xsl:template match="header" name="header">
-  <div id="vfeed"></div>
-  <div class="webtitle"><div class="webtitle-inner">
-  <table cellpadding="0" cellspacing="0" border="0"><tr>
-    <td>
-      <a href="{$pre}"><img src="{$pre}logos/csc_80_35_white.png" alt="CSC Logo" /></a>
-    </td><td>
-      <a href="{$pre}"><img src="{$pre}logos/csc_title.png" alt="CSC Title" /></a>
-    </td><td valign="top" align="right">
-    </td>
-  </tr></table>
-  </div></div>
-  <table cellspacing="0" cellpadding="2" border="0" width="100%"
-  class="template-header">
-   <tr>
-    <!--<td width="84"><a href="/"><img src="/logos/csc_80_35.png"
-    alt="CSC" width="80" height="35" border="0" /></a></td>-->
-    <td colspan="2" class="pagetitle"><xsl:value-of select="@title"/></td>
-   </tr>
-   <tr>
-    <td colspan="2">
-     <xsl:apply-templates
-      select="document(concat($pwd,'/directory.xml'))/directory"/>
-    </td>
-   </tr>
- </table>
-</xsl:template>
-
-<xsl:template match="directory">
- <xsl:if test="@href = ''"><a class="headdir diritem"
-   href="index.html"><xsl:value-of
-   select="@title"/></a></xsl:if><xsl:if test="@href != ''">
-      <a href="{@href}"><xsl:value-of select="@title"/></a></xsl:if>
- <xsl:apply-templates match="diritem"/>
-</xsl:template>
-
-<xsl:template match="diritem">
- <a class="diritem" href="{@href}"><xsl:value-of select="@title"/></a>
-</xsl:template>
-
-<xsl:template match="footer" name="footer">
- <a href="#pagetop" class="pagetop">Go to top</a>
- <div class="footer">
- <xsl:call-template name="menu"/>
- <p>
-  This page was generated on <xsl:value-of select="$date"/> at
-  <xsl:value-of select="$time"/>.
- </p>
- <p class="infobox">
-  The overall layout is designed specially for Mozilla-based browsers.
-  It is also printer-friendly. Please report any difficulty you may find, 
-  including the version of your browser and your operating system.
-  to the <a href="mailto:www@csclub.uwaterloo.ca">Webmaster</a>.
- </p>
- <p>
-  <a href="http://validator.w3.org/check?uri=referer">
-    <img src="http://www.w3.org/Icons/valid-xhtml10"
-         alt="Valid XHTML 1.0 Strict" height="31" width="88" />
-  </a>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer">
-    <img style="border:0;width:88px;height:31px"
-         src="http://jigsaw.w3.org/css-validator/images/vcss" 
-         alt="Valid CSS!" />
-  </a>
- </p>
- <div class="footerlogo"><a href="{$pre}"><img src="{$pre}logos/csc_80_35.png" alt="CSC"/></a></div>
- <p>
-   Copyright
-   <xsl:text disable-output-escaping="yes">&amp;copy;</xsl:text>
-   2002<xsl:text disable-output-escaping="yes">&amp;ndash;</xsl:text>2007
-   Computer Science Club of the University of Waterloo.<br />
-   KDE Crystal theme icons are copyright
-   <xsl:text disable-output-escaping="yes">&amp;copy;</xsl:text>
-   2002 and following years KDE Artists. Sunflower image is copyright Manan 
-   Tuli. Horde image is copyright horde contributors. Both are available under 
-   the <a href="http://creativecommons.org/licenses/by-sa/2.5/">Creative 
-   Commons::Attribution-ShareAlike license</a>. Gopher image is copyright 
-   Elron6900 (Flickr) and is available under the 
-   <a href="http://creativecommons.org/licenses/by-nc/2.0/">
-   Attribution-NonCommercial 2.0</a> license.<br/>
- </p>
- </div>
-</xsl:template>
-
-<xsl:template match="newsdefs">
- <xsl:apply-templates select="newsitem[csc:term(@date) = csc:term($date)]">
-   <xsl:sort select="translate(@date, '-', '')"
-             order="descending"
-             data-type="number"/>
- </xsl:apply-templates>
-</xsl:template>
-
-<xsl:template match="newsitem">
-   <tr>
-    <td class="newsdate"><xsl:value-of select="@date"/></td>
-    <td rowspan="2" valign="top" class="newsitem"><xsl:apply-templates/></td>
-   </tr>
-   <tr>
-    <td class="newsauthor"><xsl:value-of select="@author"/></td>
-   </tr>
-</xsl:template>
-
-<xsl:template match="news" name="news">
- <tr>
-  <th colspan="2" class="news">
-   News
-  </th>
- </tr>
- <xsl:apply-templates select="document('news.xml')/newsdefs"/>
- <tr>
-  <td class="newsitem" colspan="2">
-   <a href="news/">Older news items</a> are available. Make sure you
-   check out the <a href="/newsgroup/thread.php?group=uw.csc">uw.csc</a> newsgroup and our
-   announcement boards on the second and third floor of MC for more
-   updates.
-  </td>
- </tr>
-</xsl:template>
-
-<xsl:template match="events" name="events">
-   <tr>
-    <th colspan="2" class="news">
-     Upcoming Events <a href="events.ics">ical</a>
-    </th>
-   </tr>
-   <xsl:for-each select="document('events.xml')/eventdefs/eventitem">
-    <xsl:sort select="translate(@date, '-', '')"
-              order="ascending"
-              data-type="number"/>
-    <xsl:if test="translate(@date, '-', '') &gt;= translate($date, '-', '')">
-     <tr>
-      <td class="eventdate"><xsl:value-of select="@date"/></td>
-      <td rowspan="2" valign="top" class="eventitem"> 
-        <a href="{translate(concat('/events/', @room, '-', @date, '-', @time, '.html'), ' ', '_')}">
-        <xsl:value-of select="@title"/>
-        </a>.
-       <xsl:value-of select="short"/>
-      </td>
-     </tr>
-     <tr>
-      <td class="eventroom"><xsl:value-of select="@time"/>,
-      <xsl:value-of select="@room"/></td>
-     </tr>
-    </xsl:if>
-   </xsl:for-each>
-   <tr>
-    <td class="eventitem" colspan="2"><a href="events/">Past
-    events</a> are available.</td>
-   </tr>
-</xsl:template>
-
-<xsl:template match="eventdefs">
- <xsl:apply-templates/>
-</xsl:template>
-
-<xsl:template match="eventitem">
- <xsl:document method="xml" encoding="ISO-8859-1" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
-  href="{translate(concat($root, '/events/', @room, '-', @date, '-', @time, '.html'), ' ', '_')}">
-<html>
-<head>
- <title><xsl:value-of select="@title"/></title>
-  <link rel="stylesheet" href="{$pre}default.css" type="text/css" />
-</head>
-<body>
-<div>
- <xsl:call-template name="header">
-  <xsl:with-param name="title" select="@title"/>
- </xsl:call-template>
- <div>
-  Held in <xsl:value-of select="@room"/> at
-  <xsl:value-of select="@date"/>, <xsl:value-of select="@time"/>.
- </div>
- <h2>Abstract</h2>
- <xsl:apply-templates select="abstract/node()"/>
- <xsl:call-template name="footer"/>
-</div>
-</body>
-</html>
- </xsl:document>
-</xsl:template>
-
-<xsl:template match="news-and-events">
- <table cellspacing="1" cellpadding="2" class="newsandevents">
-  <xsl:call-template name="events"/>
-  <xsl:call-template name="news"/>
- </table>
-</xsl:template>
-
-<xsl:template match="events-this-term" name="events-by-term">
-  <p>The events for <xsl:value-of select="csc:term($date)"/> are listed here or grab an <a href="/events.ics">ical</a>.</p>
-   <xsl:for-each select="document('events.xml')/eventdefs/eventitem">
-    <xsl:sort select="translate(@date, '-', '')"
-              order="ascending"
-              data-type="number"/>
-    <xsl:if test="csc:term(@date) = csc:term($date)">
-     <h3><a href="{translate(concat($pre, 'events/', @room, '-', @date, '-', @time, '.html'), ' ', '_')}"><xsl:value-of select="@title"/></a></h3>
-     <p>
-      <b><xsl:value-of select="@room"/>,
-      <xsl:value-of select="@date"/>, <xsl:value-of
-      select="@time"/>: </b>
-      <xsl:value-of select="short"/>
-      <a href="{translate(concat($pre, 'events/', @room, '-', @date, '-', @time, '.html'), ' ', '_')}">
-       More information</a>.
-     </p>
-    </xsl:if>
-   </xsl:for-each>
-</xsl:template>
-
-<xsl:template match="news-this-term" name="news-by-term">
-  <p>The news for <xsl:value-of select="csc:term($date)"/> is listed here.</p>
-   <xsl:for-each select="document('news.xml')/newsdefs/newsitem">
-    <xsl:sort select="translate(@date, '-', '')"
-              order="descending"
-              data-type="number"/>
-    <xsl:if test="csc:term(@date) = csc:term($date)">
-     <p>
-      <b><xsl:value-of select="@date"/>,
-         <xsl:value-of select="@author"/>: </b> <xsl:apply-templates/>
-     </p>
-    </xsl:if>
-   </xsl:for-each>
-</xsl:template>
-
-<xsl:template match="members-this-term">
-  <p>The members for <xsl:value-of select="csc:term($date)"/> are
-  listed here. We currently have <xsl:value-of
-  select="count(document('members.xml')/memberlist/member)"/> members.</p>
-  <table>
-    <tr>
-      <th>Name</th>
-      <th>Program</th>
-      <th>Userid</th>
-    </tr>
-    <xsl:for-each select="document('members.xml')/memberlist/member">
-      <xsl:variable name="class">
-        <xsl:choose>
-          <xsl:when test="position() mod 2 = 0">members1</xsl:when>
-          <xsl:otherwise>members2</xsl:otherwise>
-        </xsl:choose>
-      </xsl:variable>
-      <tr class="{$class}">
-        <td><xsl:value-of select="@name"/></td>
-        <td><xsl:value-of select="@program"/></td>
-        <td><xsl:value-of select="@userid"/></td>
-      </tr>
-    </xsl:for-each>
-  </table>
-</xsl:template>
-
-<xsl:template match="all-books">
-  <p>The books we currently own include:</p>
-  <table>
-    <tr>
-      <th>Title</th>
-      <th>Author</th>
-    </tr>
-    <xsl:for-each select="document('books.xml')/booklist/book">
-      <tr>
-       <xsl:if test="position() mod 2 = 0">
-         <xsl:attribute name="bgcolor">#cee6ff</xsl:attribute>
-       </xsl:if>
-       <td><a href="{$pre}office/books/{translate(@isbn, ' ', '_')}.html">
-    <xsl:value-of select="@title"/>
-     <xsl:if test="@edition != ''">
-      (<xsl:value-of   select="@edition"/>)
-     </xsl:if>
-    </a></td>
-       <td><xsl:value-of select="@author"/></td>
-      </tr>
- <xsl:document method="xml" encoding="ISO-8859-1" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
-    href="{translate(concat($root, '/office/books/', @isbn, '.html'), ' ', '_')}">
-<html>
-<head>
- <title>Book: <xsl:value-of select="@title"/></title>
-  <link rel="stylesheet" href="{$pre}default.css" type="text/css" />
-</head>
-<body>
-<div>
- <xsl:call-template name="header">
-    <xsl:with-param name="title" select="@title"/>
-    <!-- TODO -->
-    <xsl:with-param name="pwd" select="concat($pwd, '/books')"/>
- </xsl:call-template>
-<p>
- <b>Title: </b> <xsl:value-of select="@title"/><br />
- <b>Edition: </b> <xsl:value-of select="@edition"/><br />
- <b>ISBN: </b> <xsl:value-of select="@isbn"/><br />
- <b>Author: </b> <xsl:value-of select="@author"/><br />
- <b>Published: </b> <xsl:value-of select="@published"/><br />
-</p>
-  <xsl:call-template name="footer"/>
-</div>
-</body>
-</html>
- </xsl:document>
-    </xsl:for-each>
-  </table>
-</xsl:template>
-
-<xsl:template match="generate-event-files">
- <xsl:apply-templates select="document('events.xml')/eventdefs"/>
-</xsl:template>
-
-<xsl:key name="eventterm"
-    match="/eventdefs/eventitem"
-    use="csc:term(@date)" />
-
-  <xsl:template match="old-events">
-    <xsl:for-each
-      select="document('events.xml')/eventdefs/eventitem">
-
-     <xsl:sort select="translate(@date, '-', '')"
-              order="descending"
-              data-type="number"/>
-
-      <xsl:if
-              test="not(preceding-sibling::*[csc:term(@date)=csc:term(current()/@date)]) and not(csc:term(@date) = csc:term($date))">
-       <p><a href="{translate(concat('old-',
-       csc:term(@date), '.html'), ' ', '_')}">
-           <xsl:value-of
-             select="csc:term(@date)"/></a></p>
- <xsl:document method="xml" encoding="ISO-8859-1" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
-    href="{translate(concat($root, '/events/old-', csc:term(@date), '.html'), ' ', '_')}">
-<html>
-<head>
- <title>Events for <xsl:value-of select="csc:term(@date)"/></title>
-  <link rel="stylesheet" href="{$pre}default.css" type="text/css" />
-</head>
-<body>
-<div>
- <xsl:call-template name="header">
-  <xsl:with-param name="title" select="concat('Events for ', csc:term(@date))"/>
- </xsl:call-template>
- <xsl:call-template name="events-by-term">
-   <xsl:with-param name="date" select="@date"/>
- </xsl:call-template>
- <xsl:call-template name="footer"/>
-</div>
-</body>
-</html>
- </xsl:document>
-      </xsl:if>
-    </xsl:for-each>
-  </xsl:template>
-  
-<xsl:key name="newsterm"
-    match="/newsdefs/newsitem"
-    use="csc:term(@date)" />
-
-  <xsl:template match="old-news">
-    <xsl:for-each
-      select="document('news.xml')/newsdefs/newsitem">
-
-     <xsl:sort select="translate(@date, '-', '')"
-              order="descending"
-              data-type="number"/>
-
-      <xsl:if
-              test="not(preceding-sibling::*[csc:term(@date)=csc:term(current()/@date)]) and not(csc:term(@date) = csc:term($date))">
-       <p><a href="{translate(concat('old-',
-       csc:term(@date), '.html'), ' ', '_')}">
-           <xsl:value-of
-             select="csc:term(@date)"/></a></p>
- <xsl:document method="xml" encoding="ISO-8859-1" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
-    href="{translate(concat($root, '/news/old-', csc:term(@date), '.html'), ' ', '_')}">
-<xsl:text disable-output-escaping="yes"><![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">]]>
-</xsl:text>
-<html>
-<head>
- <title>News for <xsl:value-of select="csc:term(@date)"/></title>
-  <link rel="stylesheet" href="{$pre}default.css" type="text/css" />
-</head>
-<body>
-<div>
- <xsl:call-template name="header">
-  <xsl:with-param name="title" select="concat('News for ', csc:term(@date))"/>
- </xsl:call-template>
- <xsl:call-template name="news-by-term">
-   <xsl:with-param name="date" select="@date"/>
- </xsl:call-template>
- <xsl:call-template name="footer"/>
-</div>
-</body>
-</html>
- </xsl:document>
-      </xsl:if>
-    </xsl:for-each>
-  </xsl:template>
-  
-<xsl:template match="execlist">
- <h3>Elected positions</h3>
- <ul>
-  <xsl:apply-templates select="exec[@type='elected']"/>
- </ul>
- <h3>Appointed positions</h3>
- <ul>
-  <xsl:apply-templates select="exec[@type='appointed']"/>
- </ul>
-</xsl:template>
-
-<xsl:template match="exec">
- <li><xsl:value-of select="@name"/> is this term's <b><xsl:value-of
- select="@position"/></b>. You can <a
- href="mailto:{@userid}@csclub.uwaterloo.ca">e-mail the <xsl:value-of select="@position"/></a><xsl:if
- test="not(@href='')"> or <a href="{@href}">visit 
- <xsl:choose>
-  <xsl:when test="@sex='male'"> his </xsl:when>
-  <xsl:when test="@sex='female'"> her </xsl:when>
-  <xsl:otherwise> his or her </xsl:otherwise>
- </xsl:choose>
- homepage</a></xsl:if>.
- </li>
-</xsl:template>
+<!-- include additional style sheets -->
+<xsl:include href="./xsl/common.xsl" />
+<xsl:include href="./xsl/directory.xsl" />
+<xsl:include href="./xsl/menu.xsl" />
+<xsl:include href="./xsl/exec.xsl" />
+<xsl:include href="./xsl/books.xsl" />
+<xsl:include href="./xsl/members.xsl" />
+<xsl:include href="./xsl/events.xsl" />
+<xsl:include href="./xsl/news.xsl" />
+<xsl:include href="./xsl/media.xsl" />
 
 <xsl:template match="*">
-<xsl:copy>
-<xsl:copy-of select="@*" />
-<xsl:apply-templates />
-</xsl:copy>
+  <xsl:copy>
+    <xsl:copy-of select="@*" />
+    <xsl:apply-templates />
+  </xsl:copy>
 </xsl:template>
 
-
 </xsl:stylesheet>
index d11f2f6..f085f22 100644 (file)
@@ -99,6 +99,12 @@ tr.members1 {
 tr.members2 {
     background: #cee6ff;
 }
+tr.books1 {
+    background: white;
+}
+tr.book2 {
+    background: #cee6ff;
+}
 
 img {
        border-width:0;
index e69de29..9ce9c38 100644 (file)
@@ -0,0 +1,6 @@
+<?xml version='1.0'?>
+
+<!DOCTYPE directory SYSTEM "csc.dtd">
+
+<directory title="Index">
+</directory>
diff --git a/xsl/books.xsl b/xsl/books.xsl
new file mode 100644 (file)
index 0000000..435043d
--- /dev/null
@@ -0,0 +1,64 @@
+<?xml version='1.0'?>
+
+<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:csc="http://www.csclub.uwaterloo.ca/cow" 
+    extension-element-prefixes="csc">
+
+<xsl:template match="all-books">
+  <p>The books we currently own include:</p>
+  <table>
+    <tr>
+      <th>Title</th>
+      <th>Author</th>
+    </tr>
+    <xsl:for-each select="document('../books.xml')/booklist/book">
+      <xsl:variable name="class">
+        <xsl:choose>
+          <xsl:when test="position() mod 2 = 0">books1</xsl:when>
+          <xsl:otherwise>books2</xsl:otherwise>
+        </xsl:choose>
+      </xsl:variable>
+      <tr class="{$class}" >
+        <td>
+          <a href="{$pre}office/books/{translate(@isbn, ' ', '_')}.html">
+            <xsl:value-of select="@title" />
+            <xsl:if test="@edition != ''">
+              (<xsl:value-of select="@edition" />)
+            </xsl:if>
+          </a>
+        </td>
+        <td>
+          <xsl:value-of select="@author" />
+        </td>
+      </tr>
+      <xsl:document method="xml" encoding="ISO-8859-1" 
+          doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
+          doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
+          href="{translate(concat($root, '/office/books/', @isbn, '.html'), ' ', '_')}">
+        <html>
+          <head>
+            <title>Book: <xsl:value-of select="@title" /></title>
+            <link rel="stylesheet" href="{$pre}default.css" type="text/css" />
+          </head>
+          <body><div>
+            <xsl:call-template name="header">
+              <xsl:with-param name="title" select="@title" />
+              <!-- TODO -->
+              <xsl:with-param name="pwd" select="concat($pwd, '/books')" />
+            </xsl:call-template>
+            <p>
+              <b>Title: </b> <xsl:value-of select="@title" /><br />
+              <b>Edition: </b> <xsl:value-of select="@edition" /><br />
+              <b>ISBN: </b> <xsl:value-of select="@isbn" /><br />
+              <b>Author: </b> <xsl:value-of select="@author" /><br />
+              <b>Published: </b> <xsl:value-of select="@published" /><br />
+            </p>
+            <xsl:call-template name="footer" />
+          </div></body>
+        </html>
+      </xsl:document>
+    </xsl:for-each>
+  </table>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xsl/common.xsl b/xsl/common.xsl
new file mode 100644 (file)
index 0000000..272aed8
--- /dev/null
@@ -0,0 +1,126 @@
+<?xml version='1.0'?>
+
+<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:csc="http://www.csclub.uwaterloo.ca/cow" 
+    extension-element-prefixes="csc">
+
+<xsl:template match="cscpage">
+  <html>
+    <head>
+      <title><xsl:value-of select="@title" /></title>
+      <link rel="stylesheet" href="{$pre}default.css" type="text/css" />
+    </head>
+    <body><div>
+      <a name="pagetop" id="pagetop" />
+      <xsl:apply-templates select="biglogo" />
+      <xsl:apply-templates select="header">
+        <xsl:with-param name="title" select="@title" />
+      </xsl:apply-templates>
+      <xsl:apply-templates select="section|menu" />
+      <xsl:apply-templates select="footer" />
+    </div></body>
+  </html>
+</xsl:template>
+
+<xsl:template match="section">
+  <xsl:if test="@id != ''">
+    <a id="{@id}" />
+  </xsl:if>
+  <h2><xsl:value-of select="@title" /></h2>
+  <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="biglogo" name="biglogo">
+  <div class="biglogo">
+    <table cellspacing="0" cellpadding="0" border="0">
+      <tr><td>
+        <a href="http://www.uwaterloo.ca/"><img 
+           src="{$pre}logos/uw_logo_100_68.gif" alt="University of Waterloo"
+           width="100" height="68" /></a>
+      </td><td>
+        <a href="http://www.acm.org"><img width="82" height="103" 
+           src="{$pre}logos/acm_logo.gif"
+           alt="A Student Chapter of the ACM" /></a>
+      </td></tr>
+    </table>
+  </div>
+</xsl:template>
+
+<xsl:template match="header" name="header">
+  <div id="vfeed" />
+  <div class="webtitle"><div class="webtitle-inner">
+    <table cellpadding="0" cellspacing="0" border="0"><tr>
+      <td>
+        <a href="{$pre}"><img src="{$pre}logos/csc_80_35_white.png" 
+            alt="CSC Logo" /></a>
+      </td><td>
+        <a href="{$pre}"><img src="{$pre}logos/csc_title.png" 
+            alt="CSC Title" /></a>
+      </td><td valign="top" align="right" />
+    </tr></table>
+  </div></div>
+  <table cellspacing="0" cellpadding="2" border="0" width="100%" 
+      class="template-header">
+    <tr>
+      <td colspan="2" class="pagetitle"><xsl:value-of select="@title" /></td>
+    </tr>
+    <tr>
+      <td colspan="2">
+        <xsl:apply-templates
+           select="document('../directory.xml')/directory" />
+      </td>
+    </tr>
+  </table>
+</xsl:template>
+
+<xsl:template match="footer" name="footer">
+  <a href="#pagetop" class="pagetop">Go to top</a>
+  <div class="footer">
+  <xsl:call-template name="menu" />
+  <p>This page was generated on <xsl:value-of select="$date" /> at 
+    <xsl:value-of select="$time" />.</p>
+  <p class="infobox">
+    The overall layout is designed specially for Mozilla-based browsers.
+    It is also printer-friendly. Please report any difficulty you may find, 
+    including the version of your browser and your operating system.
+    to the <a href="mailto:www@csclub.uwaterloo.ca">Webmaster</a>.
+  </p>
+  <p>
+    <a href="http://validator.w3.org/check?uri=referer">
+    <img src="http://www.w3.org/Icons/valid-xhtml10"
+        alt="Valid XHTML 1.0 Strict" height="31" width="88" />
+    </a>
+    <a href="http://jigsaw.w3.org/css-validator/check/referer">
+      <img style="border:0;width:88px;height:31px"
+          src="http://jigsaw.w3.org/css-validator/images/vcss" 
+          alt="Valid CSS!" />
+    </a>
+  </p>
+  <div class="footerlogo"><a href="{$pre}"><img src=
+      "{$pre}logos/csc_80_35.png" alt="CSC" /></a></div>
+    <p>
+      Copyright
+      <xsl:text disable-output-escaping="yes">&amp;copy;</xsl:text>
+      2002<xsl:text disable-output-escaping="yes">&amp;ndash;</xsl:text>2007
+      Computer Science Club of the University of Waterloo.<br />
+      KDE Crystal theme icons are copyright
+      <xsl:text disable-output-escaping="yes">&amp;copy;</xsl:text>
+      2002 and following years KDE Artists. Sunflower image is copyright Manan 
+      Tuli. Horde image is copyright horde contributors. Both are available 
+      under the <a href="http://creativecommons.org/licenses/by-sa/2.5/">
+      Creative Commons::Attribution-ShareAlike license</a>. Gopher image is 
+      copyright Elron6900 (Flickr) and is available under the <a
+      href="http://creativecommons.org/licenses/by-nc/2.0/">
+      Attribution-NonCommercial 2.0</a> license.
+    </p>
+  </div>
+</xsl:template>
+
+<xsl:template match="news-and-events">
+  <table cellspacing="1" cellpadding="2" class="newsandevents">
+    <xsl:call-template name="events" />
+    <xsl:call-template name="news" />
+ </table>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xsl/directory.xsl b/xsl/directory.xsl
new file mode 100644 (file)
index 0000000..0c4bded
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version='1.0'?>
+
+<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:csc="http://www.csclub.uwaterloo.ca/cow" 
+    extension-element-prefixes="csc">
+
+<xsl:template match="directory">
+  <xsl:if test="@href = ''">
+    <a class="headdir diritem" href="index.html">
+      <xsl:value-of select="@title" />
+    </a>
+  </xsl:if>
+  <xsl:if test="@href != ''">
+    <a href="{@href}"><xsl:value-of select="@title" /></a>
+  </xsl:if>
+  <xsl:apply-templates match="diritem" />
+</xsl:template>
+
+<xsl:template match="diritem">
+  <a class="diritem" href="{@href}"><xsl:value-of select="@title" /></a>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xsl/events.xsl b/xsl/events.xsl
new file mode 100644 (file)
index 0000000..dcb1cb0
--- /dev/null
@@ -0,0 +1,128 @@
+<?xml version='1.0'?>
+
+<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:csc="http://www.csclub.uwaterloo.ca/cow" 
+    extension-element-prefixes="csc">
+
+<xsl:template match="events" name="events">
+  <tr>
+    <th colspan="2" class="news">Upcoming Events</th>
+  </tr>
+  <xsl:for-each select="document('../events.xml')/eventdefs/eventitem">
+    <xsl:sort select="translate(@date, '-', '')" 
+        order="ascending" data-type="number" />
+    <xsl:if test="translate(@date, '-', '') &gt;= translate($date, '-', '')">
+      <tr>
+        <td class="eventdate"><xsl:value-of select="@date" /></td>
+        <td rowspan="2" valign="top" class="eventitem"> 
+          <a href="{translate(concat('/events/', @room, '-', @date, '-', @time, '.html'), ' ', '_')}">
+            <xsl:value-of select="@title" />
+          </a>.
+          <xsl:value-of select="short" />
+        </td>
+      </tr>
+      <tr>
+        <td class="eventroom">
+          <xsl:value-of select="@time" />,
+          <xsl:value-of select="@room" />
+        </td>
+      </tr>
+    </xsl:if>
+  </xsl:for-each>
+  <tr>
+    <td class="eventitem" colspan="2">
+      <a href="events/">Past events</a> are available.
+    </td>
+  </tr>
+</xsl:template>
+
+<xsl:template match="events-this-term" name="events-by-term">
+  <p>The events for <xsl:value-of select="csc:term($date)" /> are listed here.
+    You can also <a href="${pre}events.ics">download an ICS</a> of them.</p>
+  <xsl:for-each select="document('../events.xml')/eventdefs/eventitem">
+    <xsl:sort select="translate(@date, '-', '')" 
+        order="ascending" data-type="number" />
+    <xsl:if test="csc:term(@date) = csc:term($date)">
+      <h3><a href="{translate(concat($pre, 'events/', @room, '-', @date, '-', @time, '.html'), ' ', '_')}"><xsl:value-of select="@title" /></a></h3>
+      <p>
+        <strong>
+          <xsl:value-of select="@room" />, 
+          <xsl:value-of select="@date" />, 
+          <xsl:value-of select="@time" />:
+        </strong>
+        <xsl:value-of select="short" />.
+      </p>
+    </xsl:if>
+  </xsl:for-each>
+</xsl:template>
+
+<xsl:template match="eventdefs">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="eventitem">
+  <xsl:document method="xml" encoding="ISO-8859-1" 
+      doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" 
+      doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
+      href="{translate(concat($root, '/events/', @room, '-', @date, '-', @time, '.html'), ' ', '_')}">
+    <html>
+      <head>
+        <title><xsl:value-of select="@title" /></title>
+        <link rel="stylesheet" href="{$pre}default.css" type="text/css" />
+      </head>
+      <body><div>
+        <xsl:call-template name="header">
+          <xsl:with-param name="title" select="@title" />
+        </xsl:call-template>
+        <div>
+          Held in <xsl:value-of select="@room" /> at
+          <xsl:value-of select="@date" />, <xsl:value-of select="@time" />.
+        </div>
+        <h2>Abstract</h2>
+        <xsl:apply-templates select="abstract/node()" />
+        <xsl:call-template name="footer" />
+      </div></body>
+    </html>
+  </xsl:document>
+</xsl:template>
+
+<xsl:template match="generate-event-files">
+  <xsl:apply-templates select="document('../events.xml')/eventdefs" />
+</xsl:template>
+
+<xsl:key name="eventterm" match="/eventdefs/eventitem" use="csc:term(@date)" />
+
+<xsl:template match="old-events">
+  <xsl:for-each select="document('events.xml')/eventdefs/eventitem">
+    <xsl:sort select="translate(@date, '-', '')" 
+        order="descending" data-type="number" />
+    <xsl:if test="not(preceding-sibling::*[csc:term(@date)=csc:term(current()/@date)]) and not(csc:term(@date) = csc:term($date))">
+      <p><a href="{translate(concat('old-',csc:term(@date), '.html'), ' ', '_')}">
+        <xsl:value-of select="csc:term(@date)" />
+      </a></p>
+      <xsl:document method="xml" encoding="ISO-8859-1" 
+            doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" 
+            doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
+            href="{translate(concat($root, '/events/old-', csc:term(@date), '.html'), ' ', '_')}">
+        <html>
+          <head>
+            <title>Events for <xsl:value-of select="csc:term(@date)" /></title>
+            <link rel="stylesheet" href="{$pre}default.css" type="text/css" />
+          </head>
+          <body><div>
+            <xsl:call-template name="header">
+            <xsl:with-param name="title" 
+                select="concat('Events for ', csc:term(@date))" />
+            </xsl:call-template>
+            <xsl:call-template name="events-by-term">
+              <xsl:with-param name="date" select="@date" />
+            </xsl:call-template>
+            <xsl:call-template name="footer" />
+          </div></body>
+        </html>
+      </xsl:document>
+    </xsl:if>
+  </xsl:for-each>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xsl/exec.xsl b/xsl/exec.xsl
new file mode 100644 (file)
index 0000000..9eae18f
--- /dev/null
@@ -0,0 +1,36 @@
+<?xml version='1.0'?>
+
+<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:csc="http://www.csclub.uwaterloo.ca/cow" 
+    extension-element-prefixes="csc">
+
+<xsl:template match="execlist">
+  <h3>Elected positions</h3>
+  <ul>
+    <xsl:apply-templates select="exec[@type='elected']" />
+  </ul>
+  <h3>Appointed positions</h3>
+  <ul>
+    <xsl:apply-templates select="exec[@type='appointed']" />
+  </ul>
+</xsl:template>
+
+<xsl:template match="exec">
+  <li>
+    <xsl:value-of select="@name" /> is this term's <b>
+    <xsl:value-of select="@position" /></b>. You can <a 
+    href="mailto:{@userid}@csclub.uwaterloo.ca">e-mail the 
+    <xsl:value-of select="@position" /></a>
+    <xsl:if test="not(@href='')">
+      or <a href="{@href}">visit 
+      <xsl:choose>
+        <xsl:when test="@sex='male'"> his </xsl:when>
+        <xsl:when test="@sex='female'"> her </xsl:when>
+        <xsl:otherwise> his or her </xsl:otherwise>
+      </xsl:choose>
+      homepage</a>
+    </xsl:if>.
+  </li>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xsl/media.xsl b/xsl/media.xsl
new file mode 100644 (file)
index 0000000..7cc3498
--- /dev/null
@@ -0,0 +1,104 @@
+<?xml version='1.0'?>
+
+<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:csc="http://www.csclub.uwaterloo.ca/cow" 
+    extension-element-prefixes="csc">
+
+<xsl:template match="mediafile">
+  <xsl:param name="ext" />
+  <a href="/files/{@file}{$ext}"><xsl:value-of select="@type" /></a>, 
+</xsl:template>
+
+<xsl:template match="flvfile">
+  <script type="text/javascript" src="flash/swfobject.js"></script>
+  <p id="player1"><a href="http://www.macromedia.com/go/getflashplayer">
+    Get the Flash Player</a> to see this video using Flash Player.</p>
+  <script type="text/javascript">
+    var s1 = new SWFObject("flash/flvplayer.swf","single","400","300","7");
+    s1.addParam("allowfullscreen","true");
+    s1.addVariable("file","http://csclub.uwaterloo.ca/files/<xsl:value-of select="@file" />");
+    <xsl:if test="@preview">
+      s1.addVariable("image","http://csclub.uwaterloo.ca/files/<xsl:value-of select="@preview" />");
+    </xsl:if>
+    s1.write("player1");
+  </script>
+</xsl:template>
+
+<xsl:template match="mediaitem">
+  <xsl:document method="xml" encoding="ISO-8859-1" 
+      doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" 
+      doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
+      href="{translate(concat($root, '/media/', @title , '.html'), ' ', ' ')}">
+    <html>
+      <head>
+        <title><xsl:value-of select="@title" /></title>
+        <link rel="stylesheet" href="{$pre}default.css" type="text/css" />
+      </head>
+      <body><div>
+        <xsl:call-template name="header">
+          <xsl:with-param name="title" select="@title" />
+        </xsl:call-template>
+        <xsl:if test="abstract">
+          <h2>Abstract</h2>
+          <div>
+            <xsl:apply-templates select="abstract/node()" />
+          </div>
+        </xsl:if>
+        <xsl:if test="flvfile">
+          <h2>View</h2>
+        <div>
+          <xsl:apply-templates select="flvfile" />
+        </div>
+        </xsl:if>
+        <xsl:if test="mediafile">
+          <h2>Download</h2>
+          <div><strong>
+            HTTP (web browser):
+            <xsl:apply-templates select="mediafile" />
+            <br/><br/>
+            BitTorrent:
+            <xsl:apply-templates select="mediafile" >
+              <xsl:with-param name="ext">.torrent</xsl:with-param>
+            </xsl:apply-templates>
+          </strong></div>
+        </xsl:if>
+        <br/>
+        <!-- AddThis Bookmark Button -->
+        <script type="text/javascript">
+          addthis_url    = location.href;
+          addthis_title  = document.title;
+          addthis_pub    = 'calumt';
+        </script>
+        <script type="text/javascript" 
+            src="http://s7.addthis.com/js/addthis_widget.php?v=12" />
+        <xsl:if test="@buttons">
+          <br/><br/>
+          <!-- digg button -->
+          <script src="http://digg.com/tools/diggthis.js" 
+                  type="text/javascript" />
+          <!-- reddit button -->
+          <script type="text/javascript" 
+                  src="http://reddit.com/button.js?t=3" />
+        </xsl:if>
+        <!-- google ads -->
+        <!--
+        <script type="text/javascript">
+          google_ad_client = "pub-5235744946475097";
+          google_ad_width = 728;
+          google_ad_height = 90;
+          google_ad_format = "728x90_as";
+          google_ad_type = "text_image";
+          //2007-03-21: mcc
+          google_ad_channel = "1106187834";
+        </script>
+        <script type="text/javascript"
+            src="http://pagead2.googlesyndication.com/pagead/show_ads.js" />
+        -->
+        <xsl:call-template name="footer" />
+      </div></body>
+    </html>
+  </xsl:document>
+  <li><a href= "{@title}.html"><xsl:value-of select="@title" /></a></li>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xsl/members.xsl b/xsl/members.xsl
new file mode 100644 (file)
index 0000000..adfc328
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version='1.0'?>
+
+<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:csc="http://www.csclub.uwaterloo.ca/cow" 
+    extension-element-prefixes="csc">
+
+<xsl:template match="members-this-term">
+  <p>The members for <xsl:value-of select="csc:term($date)" /> are
+    listed here. We currently have 
+    <xsl:value-of select="count(document('../members.xml')/memberlist/member)" /> 
+    members.</p>
+  <table>
+    <tr>
+      <th>Name</th>
+      <th>Program</th>
+      <th>Userid</th>
+    </tr>
+    <xsl:for-each select="document('../members.xml')/memberlist/member">
+      <xsl:variable name="class">
+        <xsl:choose>
+          <xsl:when test="position() mod 2 = 0">members1</xsl:when>
+          <xsl:otherwise>members2</xsl:otherwise>
+        </xsl:choose>
+      </xsl:variable>
+      <tr class="{$class}">
+        <td><xsl:value-of select="@name" /></td>
+        <td><xsl:value-of select="@program" /></td>
+        <td><xsl:value-of select="@userid" /></td>
+      </tr>
+    </xsl:for-each>
+  </table>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xsl/menu.xsl b/xsl/menu.xsl
new file mode 100644 (file)
index 0000000..e0c89ae
--- /dev/null
@@ -0,0 +1,36 @@
+<?xml version='1.0'?>
+
+<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:csc="http://www.csclub.uwaterloo.ca/cow" 
+    extension-element-prefixes="csc">
+
+<xsl:template match="menuitem">
+  <xsl:variable name="pre2">
+    <xsl:choose>
+      <xsl:when test="@absolute = 'true'" />
+      <xsl:otherwise>
+        <xsl:value-of select="$pre" />
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+  <td class="menuitem">
+    <a href="{$pre2}{@href}"><img src="{$pre}buttons/{@icon}.png" width="40" 
+      height="40" alt="{@title}" /><br /><xsl:value-of select="@title" /></a>
+  </td>
+</xsl:template>
+
+<xsl:template match="menudefs">
+  <div class="menuspace">
+    <table cellspacing="0" cellpadding="0" border="0" class="menubar">
+      <tr>
+        <xsl:apply-templates select="menuitem" />
+      </tr>
+    </table>
+  </div>
+</xsl:template>
+
+<xsl:template match="menu" name="menu">
+ <xsl:apply-templates select="document('../menu.xml')/menudefs" />
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xsl/news.xsl b/xsl/news.xsl
new file mode 100644 (file)
index 0000000..c72dd0c
--- /dev/null
@@ -0,0 +1,92 @@
+<?xml version='1.0'?>
+
+<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:csc="http://www.csclub.uwaterloo.ca/cow" 
+    extension-element-prefixes="csc">
+
+<xsl:template match="newsdefs">
+  <xsl:apply-templates select="newsitem[csc:term(@date) = csc:term($date)]">
+    <xsl:sort select="translate(@date, '-', '')" 
+        order="descending" data-type="number" />
+  </xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="newsitem">
+  <tr>
+    <td class="newsdate"><xsl:value-of select="@date" /></td>
+    <td rowspan="2" valign="top" class="newsitem"><xsl:apply-templates/></td>
+  </tr>
+  <tr>
+    <td class="newsauthor"><xsl:value-of select="@author" /></td>
+  </tr>
+</xsl:template>
+
+<xsl:template match="news" name="news">
+  <tr>
+    <th colspan="2" class="news">News</th>
+  </tr>
+  <xsl:apply-templates select="document('../news.xml')/newsdefs" />
+  <tr>
+    <td class="newsitem" colspan="2">
+      <a href="news/">Older news items</a> are available. Make sure you check 
+      out the <a href="/newsgroup/thread.php?group=uw.csc">uw.csc</a> 
+      newsgroup and our announcement boards on the second and third floor of 
+      MC for more updates. You can also 
+      <a href="events.ics">download an ICS</a> of our events.
+    </td>
+  </tr>
+</xsl:template>
+
+<xsl:template match="news-this-term" name="news-by-term">
+  <p>The news for <xsl:value-of select="csc:term($date)" /> is listed here.</p>
+  <xsl:for-each select="document('../news.xml')/newsdefs/newsitem">
+    <xsl:sort select="translate(@date, '-', '')" 
+        order="descending" data-type="number" />
+    <xsl:if test="csc:term(@date) = csc:term($date)">
+      <p>
+        <strong>
+          <xsl:value-of select="@date" />,
+          <xsl:value-of select="@author" />:
+        </strong>
+        <xsl:apply-templates/>
+      </p>
+    </xsl:if>
+  </xsl:for-each>
+</xsl:template>
+
+<xsl:key name="newsterm" match="/newsdefs/newsitem" use="csc:term(@date)" />
+
+<xsl:template match="old-news">
+  <xsl:for-each select="document('../news.xml')/newsdefs/newsitem">
+    <xsl:sort select="translate(@date, '-', '')" 
+        order="descending" data-type="number" />
+    <xsl:if test="not(preceding-sibling::*[csc:term(@date)=csc:term(current()/@date)]) and not(csc:term(@date) = csc:term($date))">
+         <p><a href="{translate(concat('old-', csc:term(@date), '.html'), ' ', '_')}">
+           <xsl:value-of select="csc:term(@date)" />
+      </a></p>
+      <xsl:document method="xml" encoding="ISO-8859-1"
+          doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
+          doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
+          href="{translate(concat($root, '/news/old-', csc:term(@date), '.html'), ' ', '_')}">
+        <html>
+          <head>
+            <title>News for <xsl:value-of select="csc:term(@date)" /></title>
+            <link rel="stylesheet" href="{$pre}default.css" type="text/css" />
+          </head>
+          <body><div>
+            <xsl:call-template name="header">
+              <xsl:with-param name="title"
+                  select="concat('News for ', csc:term(@date))" />
+            </xsl:call-template>
+            <xsl:call-template name="news-by-term">
+              <xsl:with-param name="date" select="@date" />
+            </xsl:call-template>
+            <xsl:call-template name="footer" />
+          </div></body>
+        </html>
+      </xsl:document>
+    </xsl:if>
+  </xsl:for-each>
+</xsl:template>
+
+</xsl:stylesheet>