]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/mowgli/home/xsl/common.xsl
ocaml 3.09 transition
[helm.git] / helm / mowgli / home / xsl / common.xsl
index 2308630f5956842f32f07db6b3f3ef415caee2a6..9381c2d20e07fe6e3a0566b766e6f9e96d3e9ee8 100644 (file)
 <xsl:stylesheet version="1.0"
                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 
+<xsl:param name="current-date" select="'???'"/>
+
 <xsl:template name="head">
-  <div class="right">
-   <div class="small">
-    <a href="home.html">MoWGLI: Mathematics on the Web: Get It by Logic and Interfaces</a>
-   </div>
-  </div>
+  <xsl:param name="path_to_top" select="'.'"/>
+  <br />
+  <table border="0" cellspacing="0" cellpadding="0" width="100%">
+    <tr>
+      <td align="left" valign="bottom">
+        <div class="small">
+          <a href="{$path_to_top}/home.html">MoWGLI: Mathematics on the Web: Get It by Logic and Interfaces</a>
+       </div>
+      </td>
+      <td align="right" valign="bottom">
+        <div class="small">
+          <a href="http://www.cordis.lu/ist"><img border="0" alt="IST Logo Small" src="{$path_to_top}/../images/istbutton_small.gif"/></a>
+        </div>
+      </td>
+    </tr>
+  </table>
   <hr/>
 </xsl:template>
 
 <xsl:template name="foot">
+  <xsl:param name="path_to_top" select="'.'"/>
   <hr/>
-  <div class="small">
-   This page is hosted by the
-   <a href="http://www.cs.unibo.it">Department of Computer Science</a>,
-   <a href="http://www.unibo.it">University of Bologna</a>
-  </div>
+  <table border="0" cellspacing="0" cellpadding="0" width="100%">
+    <tr>
+      <td align="left" valign="top">
+        <div class="small">
+          This page is hosted by the
+          <a href="http:/www.cs.unibo.it">Department of Computer Science</a>,
+          <a href="http://www.unibo.it">University of Bologna</a>.
+         <br />
+         Last updated <b><xsl:value-of select="$current-date"/></b>.
+        </div>
+      </td>
+      <td align="right" valign="top">
+        <div class="small">
+          <a href="http://www.cordis.lu/ist"><img border="0" alt="IST Logo Small" src="{$path_to_top}/../images/istbutton_small.gif"/></a>
+        </div>
+      </td>
+    </tr>
+  </table>
+  <br />
 </xsl:template>
 
 <xsl:template name="person-name">
   <xsl:param name="file" select="''"/>
-  <xsl:value-of select="document(concat('../xml/people/',$file,'.xml'))/person/name"/>
+  <xsl:param name="form" select="'full'"/>
+  <xsl:variable name="person" select="document(concat('../xml/people/',$file,'.xml'))/person"/>
+  <xsl:if test="$person/qualification and $form = 'full'">
+   <xsl:value-of select="$person/qualification"/>
+   <xsl:value-of select="' '"/>
+  </xsl:if>
+  <xsl:choose>
+   <xsl:when test="$form = 'full'">
+    <xsl:value-of select="$person/name"/>
+   </xsl:when>
+   <xsl:otherwise>
+    <!-- Bug: just the first name is abbreviated. The others are ignored. -->
+    <xsl:value-of select="substring($person/name,1,1)"/>
+    <xsl:text>.</xsl:text>
+   </xsl:otherwise>
+  </xsl:choose>
   <xsl:value-of select="' '"/>
-  <xsl:value-of select="document(concat('../xml/people/',$file,'.xml'))/person/surname"/>
+  <xsl:value-of select="$person/surname"/>
 </xsl:template>
 
-</xsl:stylesheet>
+<xsl:template name="print_date">
+ <xsl:param name="date"/>
+ <xsl:variable name="year" select="substring($date,1,4)"/>
+ <xsl:variable name="month" select="substring($date,5,2)"/>
+ <xsl:variable name="day" select="substring($date,7,2)"/>
+ <xsl:call-template name="print_month">
+  <xsl:with-param name="month" select="$month"/>
+ </xsl:call-template>
+ <xsl:text> </xsl:text>
+ <xsl:call-template name="print_day">
+  <xsl:with-param name="day" select="$day"/>
+ </xsl:call-template>
+ <xsl:text>, </xsl:text>
+ <xsl:value-of select="$year"/>
+</xsl:template>
+
+<xsl:template name="print_month">
+ <xsl:param name="month"/>
+ <xsl:choose>
+  <xsl:when test="$month = '01'">January</xsl:when>
+  <xsl:when test="$month = '02'">February</xsl:when>
+  <xsl:when test="$month = '03'">March</xsl:when>
+  <xsl:when test="$month = '04'">April</xsl:when>
+  <xsl:when test="$month = '05'">May</xsl:when>
+  <xsl:when test="$month = '06'">June</xsl:when>
+  <xsl:when test="$month = '07'">July</xsl:when>
+  <xsl:when test="$month = '08'">August</xsl:when>
+  <xsl:when test="$month = '09'">September</xsl:when>
+  <xsl:when test="$month = '10'">October</xsl:when>
+  <xsl:when test="$month = '11'">November</xsl:when>
+  <xsl:when test="$month = '12'">December</xsl:when>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template name="print_day">
+ <xsl:param name="day"/>
+ <xsl:choose>
+  <xsl:when test="$day = '01'">1st</xsl:when>
+  <xsl:when test="$day = '02'">2nd</xsl:when>
+  <xsl:when test="$day = '03'">3rd</xsl:when>
+  <xsl:when test="$day = '11'">11th</xsl:when>
+  <xsl:when test="$day = '11'">12th</xsl:when>
+  <xsl:when test="$day = '11'">13th</xsl:when>
+  <xsl:when test="substring($day,2,1) = '1'">
+   <xsl:value-of select="$day"/>
+   <xsl:text>st</xsl:text>
+  </xsl:when>
+  <xsl:when test="substring($day,2,1) = '2'">
+   <xsl:value-of select="$day"/>
+   <xsl:text>nd</xsl:text>
+  </xsl:when>
+  <xsl:when test="substring($day,2,1) = '3'">
+   <xsl:value-of select="$day"/>
+   <xsl:text>rd</xsl:text>
+  </xsl:when>
+  <xsl:otherwise>
+   <xsl:value-of select="$day"/>
+   <xsl:text>th</xsl:text>
+  </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template name="print_interval">
+ <xsl:param name="begin"/>
+ <xsl:param name="end"/>
+ <xsl:variable name="byear" select="substring($begin,1,4)"/>
+ <xsl:variable name="bmonth" select="substring($begin,5,2)"/>
+ <xsl:variable name="bday" select="substring($begin,7,2)"/>
+ <xsl:variable name="eyear" select="substring($end,1,4)"/>
+ <xsl:variable name="emonth" select="substring($end,5,2)"/>
+ <xsl:variable name="eday" select="substring($end,7,2)"/>
+ <xsl:choose>
+  <xsl:when test="$byear != $eyear">
+   <xsl:call-template name="print_date">
+    <xsl:with-param name="date" select="$begin"/>
+   </xsl:call-template>
+   <xsl:call-template name="print_date">
+    <xsl:text> - </xsl:text>
+    <xsl:with-param name="date" select="$end"/>
+   </xsl:call-template>
+  </xsl:when>
+  <xsl:when test="$bmonth != $emonth">
+   <xsl:call-template name="print_month">
+    <xsl:with-param name="month" select="$bmonth"/>
+   </xsl:call-template>
+   <xsl:text> </xsl:text>
+   <xsl:call-template name="print_day">
+    <xsl:with-param name="day" select="$bday"/>
+   </xsl:call-template>
+   <xsl:text> - </xsl:text>
+   <xsl:call-template name="print_month">
+    <xsl:with-param name="month" select="$emonth"/>
+   </xsl:call-template>
+   <xsl:text> </xsl:text>
+   <xsl:call-template name="print_day">
+    <xsl:with-param name="day" select="$eday"/>
+   </xsl:call-template>
+   <xsl:text>, </xsl:text>
+   <xsl:value-of select="$byear"/>
+  </xsl:when>
+  <xsl:when test="$bday != $eday">
+   <xsl:call-template name="print_month">
+    <xsl:with-param name="month" select="$bmonth"/>
+   </xsl:call-template>
+   <xsl:text> </xsl:text>
+   <xsl:call-template name="print_day">
+    <xsl:with-param name="day" select="$bday"/>
+   </xsl:call-template>
+   <xsl:text> - </xsl:text>
+   <xsl:call-template name="print_day">
+    <xsl:with-param name="day" select="$eday"/>
+   </xsl:call-template>
+   <xsl:text>, </xsl:text>
+   <xsl:value-of select="$byear"/>
+  </xsl:when>
+  <xsl:otherwise>
+   <xsl:call-template name="print_date">
+    <xsl:with-param name="date" select="$begin"/>
+   </xsl:call-template>
+  </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
 
+<xsl:template name="color_of_deadline_kind">
+ <xsl:param name="kind"/>
+ <xsl:choose>
+  <xsl:when test="$kind = 'submission'">
+   <xsl:text>red</xsl:text>
+  </xsl:when>
+  <xsl:when test="$kind = 'notification'">
+   <xsl:text>green</xsl:text>
+  </xsl:when>
+  <xsl:when test="$kind = 'registration'">
+   <xsl:text>blue</xsl:text>
+  </xsl:when>
+  <xsl:when test="$kind = 'camera-ready'">
+   <xsl:text>maroon</xsl:text>
+  </xsl:when>
+ </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>