old-website/cscweb.xsl

276 lines
7.7 KiB
XML
Executable File

<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:csc="http://www.csclub.uwaterloo.ca/cow"
extension-element-prefixes="csc">
<xsl:output method="html" />
<xsl:template match="cscpage">
<xsl:text disable-output-escaping="yes"><![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">]]>
</xsl:text>
<html>
<head>
<title><xsl:value-of select="@title"/></title>
<style type="text/css">
<![CDATA[<!-- @import url('/default.css'); -->]]>
</style>
</head>
<body>
<p>
<xsl:value-of select="csc:term($date)"/>
</p>
<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"/>
</body>
</html>
</xsl:template>
<xsl:template match="section">
<h2><xsl:value-of select="@title"/></h2>
<xsl:apply-templates />
</xsl:template>
<xsl:template match="biglogo" name="menu">
<table cellspacing="0" cellpadding="2" border="0" align="center">
<tr>
<td width="174" rowspan="2"><img src="/logos/csc_160_70.png" alt="CSC" width="165" height="75" /></td>
<td>University of Waterloo</td>
</tr>
<tr>
<td>Computer Science Club</td>
</tr>
</table>
</xsl:template>
<xsl:template match="menuitem">
<td class="button">
<a href="{@href}"><img border="0" src="/buttons/{@icon}.png"
width="40" height="40" alt="" /></a><br />
<a href="{@href}"><xsl:value-of select="@title"/></a>
</td>
</xsl:template>
<xsl:template match="menudefs">
<table cellspacing="1" cellpadding="3" border="0" bgcolor="black" align="center">
<tr>
<xsl:apply-templates select="menuitem"/>
</tr>
</table>
</xsl:template>
<xsl:template match="menu" name="menu">
<xsl:apply-templates select="document('menu.xml')/menudefs"/>
</xsl:template>
<xsl:template match="header" name="header">
<table cellspacing="0" cellpadding="2" border="0" width="100%"
bgcolor="#cee6ff">
<tr>
<td width="84"><a href="/"><img src="/logos/csc_80_35.png"
alt="CSC" width="80" height="35" border="0" /></a></td>
<td 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">
[<a href="index.html"><xsl:value-of select="@title"/></a>]
<xsl:apply-templates match="diritem"/>
</xsl:template>
<xsl:template match="diritem">
[<a href="{@href}"><xsl:value-of select="@title"/></a>]
</xsl:template>
<xsl:template match="footer" name="footer">
<hr />
<xsl:call-template name="menu"/>
<p>
This page was generated on <xsl:value-of select="$date"/> at
<xsl:value-of select="$time"/>.
</p>
<p>
Copyright 2002 the Computer Science Club of the University of
Waterloo. Please direct website comments to the <a
href="mailto:www@csclub.uwaterloo.ca">Webmaster</a>.
</p>
</xsl:template>
<xsl:template match="newsdefs">
<xsl:apply-templates select="newsitem"/>
</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="nntp://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
</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="html"
href="{translate(concat($root, '/events/', @room, '-', @date, '-', @time, '.html'), ' ', '_')}">
<xsl:text disable-output-escaping="yes"><![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">]]>
</xsl:text>
<html>
<head>
<title><xsl:value-of select="@title"/></title>
<style type="text/css">
<![CDATA[<!-- @import url('/default.css'); -->]]>
</style>
</head>
<body>
<xsl:call-template name="header">
<xsl:with-param name="title" select="@title"/>
</xsl:call-template>
<p>
Held in <xsl:value-of select="@room"/> at
<xsl:value-of select="@date"/>, <xsl:value-of select="@time"/>.
</p>
<h2>Abstract</h2>
<xsl:apply-templates select="abstract"/>
<xsl:call-template name="footer"/>
</body>
</html>
</xsl:document>
</xsl:template>
<xsl:template match="news-and-events">
<table cellspacing="1" cellpadding="2" bgcolor="black">
<xsl:call-template name="news"/>
<xsl:call-template name="events"/>
</table>
</xsl:template>
<xsl:template match="events-this-term">
<p>The events for <xsl:value-of select="csc:term($date)"/> are listed here.</p>
<xsl:for-each select="document('events.xml')/eventdefs/eventitem">
<xsl:sort select="translate(@date, '-', '')"
order="ascending"
data-type="number"/>
<xsl:if test="@term = csc:term($date)">
<h3><xsl:value-of select="@title"/></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('/events/', @room, '-', @date, '-', @time, '.html'), ' ', '_')}">
More information</a>.
</p>
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template match="generate-event-files">
<xsl:apply-templates select="document('events.xml')/eventdefs"/>
</xsl:template>
<xsl:template match="old-events">
<xsl:for-each select="document('events.xml')/eventdefs/eventitem">
<xsl:sort select="term"
order="descending"
data-type="number"/>
</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 them</a><xsl:if
test="not(@href='')"> or <a href="{@href}">visit their
homepage</a></xsl:if>.
</li>
</xsl:template>
<xsl:template match="*">
<xsl:copy>
<xsl:copy-of select="@*" />
<xsl:apply-templates />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>