]> matita.cs.unibo.it Git - helm.git/blob - helm/mowgli/home/xsl/common.xsl
ocaml 3.09 transition
[helm.git] / helm / mowgli / home / xsl / common.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:param name="current-date" select="'???'"/>
7
8 <xsl:template name="head">
9   <xsl:param name="path_to_top" select="'.'"/>
10   <br />
11   <table border="0" cellspacing="0" cellpadding="0" width="100%">
12     <tr>
13       <td align="left" valign="bottom">
14         <div class="small">
15           <a href="{$path_to_top}/home.html">MoWGLI: Mathematics on the Web: Get It by Logic and Interfaces</a>
16         </div>
17       </td>
18       <td align="right" valign="bottom">
19         <div class="small">
20           <a href="http://www.cordis.lu/ist"><img border="0" alt="IST Logo Small" src="{$path_to_top}/../images/istbutton_small.gif"/></a>
21         </div>
22       </td>
23     </tr>
24   </table>
25   <hr/>
26 </xsl:template>
27
28 <xsl:template name="foot">
29   <xsl:param name="path_to_top" select="'.'"/>
30   <hr/>
31   <table border="0" cellspacing="0" cellpadding="0" width="100%">
32     <tr>
33       <td align="left" valign="top">
34         <div class="small">
35           This page is hosted by the
36           <a href="http:/www.cs.unibo.it">Department of Computer Science</a>,
37           <a href="http://www.unibo.it">University of Bologna</a>.
38           <br />
39           Last updated <b><xsl:value-of select="$current-date"/></b>.
40         </div>
41       </td>
42       <td align="right" valign="top">
43         <div class="small">
44           <a href="http://www.cordis.lu/ist"><img border="0" alt="IST Logo Small" src="{$path_to_top}/../images/istbutton_small.gif"/></a>
45         </div>
46       </td>
47     </tr>
48   </table>
49   <br />
50 </xsl:template>
51
52 <xsl:template name="person-name">
53   <xsl:param name="file" select="''"/>
54   <xsl:param name="form" select="'full'"/>
55   <xsl:variable name="person" select="document(concat('../xml/people/',$file,'.xml'))/person"/>
56   <xsl:if test="$person/qualification and $form = 'full'">
57    <xsl:value-of select="$person/qualification"/>
58    <xsl:value-of select="' '"/>
59   </xsl:if>
60   <xsl:choose>
61    <xsl:when test="$form = 'full'">
62     <xsl:value-of select="$person/name"/>
63    </xsl:when>
64    <xsl:otherwise>
65     <!-- Bug: just the first name is abbreviated. The others are ignored. -->
66     <xsl:value-of select="substring($person/name,1,1)"/>
67     <xsl:text>.</xsl:text>
68    </xsl:otherwise>
69   </xsl:choose>
70   <xsl:value-of select="' '"/>
71   <xsl:value-of select="$person/surname"/>
72 </xsl:template>
73
74 <xsl:template name="print_date">
75  <xsl:param name="date"/>
76  <xsl:variable name="year" select="substring($date,1,4)"/>
77  <xsl:variable name="month" select="substring($date,5,2)"/>
78  <xsl:variable name="day" select="substring($date,7,2)"/>
79  <xsl:call-template name="print_month">
80   <xsl:with-param name="month" select="$month"/>
81  </xsl:call-template>
82  <xsl:text> </xsl:text>
83  <xsl:call-template name="print_day">
84   <xsl:with-param name="day" select="$day"/>
85  </xsl:call-template>
86  <xsl:text>, </xsl:text>
87  <xsl:value-of select="$year"/>
88 </xsl:template>
89
90 <xsl:template name="print_month">
91  <xsl:param name="month"/>
92  <xsl:choose>
93   <xsl:when test="$month = '01'">January</xsl:when>
94   <xsl:when test="$month = '02'">February</xsl:when>
95   <xsl:when test="$month = '03'">March</xsl:when>
96   <xsl:when test="$month = '04'">April</xsl:when>
97   <xsl:when test="$month = '05'">May</xsl:when>
98   <xsl:when test="$month = '06'">June</xsl:when>
99   <xsl:when test="$month = '07'">July</xsl:when>
100   <xsl:when test="$month = '08'">August</xsl:when>
101   <xsl:when test="$month = '09'">September</xsl:when>
102   <xsl:when test="$month = '10'">October</xsl:when>
103   <xsl:when test="$month = '11'">November</xsl:when>
104   <xsl:when test="$month = '12'">December</xsl:when>
105  </xsl:choose>
106 </xsl:template>
107
108 <xsl:template name="print_day">
109  <xsl:param name="day"/>
110  <xsl:choose>
111   <xsl:when test="$day = '01'">1st</xsl:when>
112   <xsl:when test="$day = '02'">2nd</xsl:when>
113   <xsl:when test="$day = '03'">3rd</xsl:when>
114   <xsl:when test="$day = '11'">11th</xsl:when>
115   <xsl:when test="$day = '11'">12th</xsl:when>
116   <xsl:when test="$day = '11'">13th</xsl:when>
117   <xsl:when test="substring($day,2,1) = '1'">
118    <xsl:value-of select="$day"/>
119    <xsl:text>st</xsl:text>
120   </xsl:when>
121   <xsl:when test="substring($day,2,1) = '2'">
122    <xsl:value-of select="$day"/>
123    <xsl:text>nd</xsl:text>
124   </xsl:when>
125   <xsl:when test="substring($day,2,1) = '3'">
126    <xsl:value-of select="$day"/>
127    <xsl:text>rd</xsl:text>
128   </xsl:when>
129   <xsl:otherwise>
130    <xsl:value-of select="$day"/>
131    <xsl:text>th</xsl:text>
132   </xsl:otherwise>
133  </xsl:choose>
134 </xsl:template>
135
136 <xsl:template name="print_interval">
137  <xsl:param name="begin"/>
138  <xsl:param name="end"/>
139  <xsl:variable name="byear" select="substring($begin,1,4)"/>
140  <xsl:variable name="bmonth" select="substring($begin,5,2)"/>
141  <xsl:variable name="bday" select="substring($begin,7,2)"/>
142  <xsl:variable name="eyear" select="substring($end,1,4)"/>
143  <xsl:variable name="emonth" select="substring($end,5,2)"/>
144  <xsl:variable name="eday" select="substring($end,7,2)"/>
145  <xsl:choose>
146   <xsl:when test="$byear != $eyear">
147    <xsl:call-template name="print_date">
148     <xsl:with-param name="date" select="$begin"/>
149    </xsl:call-template>
150    <xsl:call-template name="print_date">
151     <xsl:text> - </xsl:text>
152     <xsl:with-param name="date" select="$end"/>
153    </xsl:call-template>
154   </xsl:when>
155   <xsl:when test="$bmonth != $emonth">
156    <xsl:call-template name="print_month">
157     <xsl:with-param name="month" select="$bmonth"/>
158    </xsl:call-template>
159    <xsl:text> </xsl:text>
160    <xsl:call-template name="print_day">
161     <xsl:with-param name="day" select="$bday"/>
162    </xsl:call-template>
163    <xsl:text> - </xsl:text>
164    <xsl:call-template name="print_month">
165     <xsl:with-param name="month" select="$emonth"/>
166    </xsl:call-template>
167    <xsl:text> </xsl:text>
168    <xsl:call-template name="print_day">
169     <xsl:with-param name="day" select="$eday"/>
170    </xsl:call-template>
171    <xsl:text>, </xsl:text>
172    <xsl:value-of select="$byear"/>
173   </xsl:when>
174   <xsl:when test="$bday != $eday">
175    <xsl:call-template name="print_month">
176     <xsl:with-param name="month" select="$bmonth"/>
177    </xsl:call-template>
178    <xsl:text> </xsl:text>
179    <xsl:call-template name="print_day">
180     <xsl:with-param name="day" select="$bday"/>
181    </xsl:call-template>
182    <xsl:text> - </xsl:text>
183    <xsl:call-template name="print_day">
184     <xsl:with-param name="day" select="$eday"/>
185    </xsl:call-template>
186    <xsl:text>, </xsl:text>
187    <xsl:value-of select="$byear"/>
188   </xsl:when>
189   <xsl:otherwise>
190    <xsl:call-template name="print_date">
191     <xsl:with-param name="date" select="$begin"/>
192    </xsl:call-template>
193   </xsl:otherwise>
194  </xsl:choose>
195 </xsl:template>
196
197 <xsl:template name="color_of_deadline_kind">
198  <xsl:param name="kind"/>
199  <xsl:choose>
200   <xsl:when test="$kind = 'submission'">
201    <xsl:text>red</xsl:text>
202   </xsl:when>
203   <xsl:when test="$kind = 'notification'">
204    <xsl:text>green</xsl:text>
205   </xsl:when>
206   <xsl:when test="$kind = 'registration'">
207    <xsl:text>blue</xsl:text>
208   </xsl:when>
209   <xsl:when test="$kind = 'camera-ready'">
210    <xsl:text>maroon</xsl:text>
211   </xsl:when>
212  </xsl:choose>
213 </xsl:template>
214
215 </xsl:stylesheet>