CSC Web Site
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
www/xsl/news.xsl

90 lines
3.3 KiB

<?xml version='1.0'?>
<xsl:stylesheet version="2.0"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:csc="http://csclub.uwaterloo.ca/xslt">
<xsl:template match="newsdefs">
<xsl:apply-templates select="newsitem[csc:term(@date) = csc:term($g_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(concat($g_root, '/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 name="news-by-term">
<xsl:param name="date" />
<p>The news for <xsl:value-of select="csc:term($date)" /> is listed here.</p>
<xsl:for-each select="document(concat($g_root, '/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:template match="old-news">
<xsl:for-each select="document(concat($g_root, '/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($g_date))">
<p><a href="{translate(concat('old-', csc:term(@date), '.html'), ' ', '_')}">
<xsl:value-of select="csc:term(@date)" />
</a></p>
<xsl:result-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($g_outdir, 'old-', csc:term(@date), '.html'), ' ', '_')}">
<html>
<head>
<title>News for <xsl:value-of select="csc:term(@date)" /></title>
<link rel="stylesheet" href="{$g_pre}default.css" type="text/css" />
</head>
<body><div>
<xsl:call-template name="header" />
<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:result-document>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>