]> matita.cs.unibo.it Git - helm.git/blob - helm/mowgli/home/xsl/deadlines.xsl
* Notion of future and past events/deadlines introduced.
[helm.git] / helm / mowgli / home / xsl / deadlines.xsl
1 <?xml version="1.0"?>
2
3 <xsl:stylesheet version="1.0"
4                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
5
6 <xsl:import href="common.xsl"/>
7
8 <xsl:output method="html"/>
9
10 <xsl:param name="events-class" select="''"/>
11 <xsl:param name="today" select="''"/>
12
13 <xsl:template match="/">
14  <html>
15   <head>
16    <title>
17     <xsl:value-of select="$events-class"/>
18     <xsl:text> Events Sorted by Deadlines</xsl:text>
19    </title>
20    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
21    <link rel="stylesheet" href="../style/mowgli.css" type="text/css"/>
22   </head>
23   <body>
24     <xsl:call-template name="head">
25      <xsl:with-param name="path_to_top" select="'.'"/>
26     </xsl:call-template>
27     <h1>
28      <xsl:value-of select="$events-class"/>
29      <xsl:text> Events</xsl:text>
30     </h1>
31     <xsl:variable name="url">
32      <xsl:choose>
33       <xsl:when test="$events-class='Other'">other-events.html</xsl:when>
34       <xsl:otherwise>mowgli-events.html</xsl:otherwise>
35      </xsl:choose>
36     </xsl:variable>
37     [<a href="{$url}">Sorted by event date</a>] [Sorted by deadline]
38     <br /><br />
39     <hr />
40     <ul>
41      <xsl:apply-templates select="events/event/deadline[date &gt;= $today]">
42       <xsl:sort select="date" data-type="number"/>
43      </xsl:apply-templates>
44     </ul>
45     <hr />
46     <h1>Past Events</h1>
47     <ul>
48      <xsl:apply-templates select="events/event/deadline[date &lt; $today]">
49       <xsl:sort select="date" data-type="number" order="descending"/>
50      </xsl:apply-templates>
51     </ul>
52     <xsl:call-template name="foot">
53      <xsl:with-param name="path_to_top" select="'.'"/>
54     </xsl:call-template>
55   </body>
56  </html>
57 </xsl:template>
58
59 <xsl:template match="deadline">
60  <li>
61   <b>
62    <xsl:variable name="kind">
63     <xsl:call-template name="color_of_deadline_kind">
64      <xsl:with-param name="kind" select="@kind"/>
65     </xsl:call-template>
66    </xsl:variable>
67    <span style="color: {$kind}">
68     <xsl:call-template name="print_date">
69      <xsl:with-param name="date" select="date/text()"/>
70     </xsl:call-template>
71    </span>
72   </b>
73   <xsl:text> </xsl:text>
74   <xsl:value-of select="description"/>
75   <xsl:text> </xsl:text>
76   <a href="{../url}" target="_top"><xsl:value-of select="../name"/></a>
77  </li>
78 </xsl:template>
79
80 </xsl:stylesheet>
81