Fetch positions (including exec) from ldap
[mspang/www.git] / xsl / news.xsl
1 <?xml version='1.0'?>
2
3 <xsl:stylesheet version="1.0"
4     xmlns="http://www.w3.org/1999/xhtml"
5     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
6     xmlns:csc="http://csclub.uwaterloo.ca/xsltproc">
7
8 <xsl:template match="newsdefs">
9   <xsl:apply-templates select="newsitem[csc:term(@date) = csc:term($g_date)]">
10     <xsl:sort select="translate(@date, '-', '')"
11         order="descending" data-type="number" />
12   </xsl:apply-templates>
13 </xsl:template>
14
15 <xsl:template match="newsitem">
16   <tr>
17     <td class="newsdate"><xsl:value-of select="@date" /></td>
18     <td rowspan="2" valign="top" class="newsitem"><xsl:apply-templates/></td>
19   </tr>
20   <tr>
21     <td class="newsauthor"><xsl:value-of select="@author" /></td>
22   </tr>
23 </xsl:template>
24
25 <xsl:template match="news" name="news">
26   <tr>
27     <th colspan="2" class="news">News</th>
28   </tr>
29   <xsl:apply-templates select="document(concat($g_root, '/news.xml'))/newsdefs" />
30   <tr>
31     <td class="newsitem" colspan="2">
32       <a href="news/">Older news items</a> are available. Make sure you check
33       out the <a href="/newsgroup/thread.php?group=uw.csc">uw.csc</a>
34       newsgroup and our announcement boards on the second and third floor of
35       MC for more updates. You can also
36       <a href="events.ics">download an ICS</a> of our events.
37     </td>
38   </tr>
39 </xsl:template>
40
41 <xsl:template name="news-by-term">
42   <xsl:param name="date" />
43   <p>The news for <xsl:value-of select="csc:term($date)" /> is listed here.</p>
44   <xsl:for-each select="document(concat($g_root, '/news.xml'))/newsdefs/newsitem">
45     <xsl:sort select="translate(@date, '-', '')"
46         order="descending" data-type="number" />
47     <xsl:if test="csc:term(@date) = csc:term($date)">
48       <p>
49         <strong>
50           <xsl:value-of select="@date" />,
51           <xsl:value-of select="@author" />:
52         </strong>
53         <xsl:apply-templates/>
54       </p>
55     </xsl:if>
56   </xsl:for-each>
57 </xsl:template>
58
59 <xsl:template match="old-news">
60   <xsl:for-each select="document(concat($g_root, '/news.xml'))/newsdefs/newsitem">
61     <xsl:sort select="translate(@date, '-', '')"
62         order="descending" data-type="number" />
63     <xsl:if test="not(preceding-sibling::*[csc:term(@date)=csc:term(current()/@date)]) and not(csc:term(@date) = csc:term($g_date))">
64       <p><a href="{translate(concat('old-', csc:term(@date), '.html'), ' ', '_')}">
65         <xsl:value-of select="csc:term(@date)" />
66       </a></p>
67       <xsl:document method="xml" encoding="ISO-8859-1"
68           doctype-public="-//W3C//DTD XHTML 1.1//EN"
69           doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"
70           href="{translate(concat($g_outdir, 'old-', csc:term(@date), '.html'), ' ', '_')}">
71         <html>
72           <head>
73             <title>News for <xsl:value-of select="csc:term(@date)" /></title>
74             <link rel="stylesheet" href="{$g_pre}default.css" type="text/css" />
75           </head>
76           <body><div>
77             <xsl:call-template name="header" />
78             <xsl:call-template name="news-by-term">
79               <xsl:with-param name="date" select="@date" />
80             </xsl:call-template>
81             <xsl:call-template name="footer" />
82           </div></body>
83         </html>
84       </xsl:document>
85     </xsl:if>
86   </xsl:for-each>
87 </xsl:template>
88
89 </xsl:stylesheet>