Merge branch 'master' of caffeine:/users/www/www/
[mspang/www.git] / xsl / functions.xsl
1 <?xml version='1.0'?>
2
3 <xsl:stylesheet version="2.0"
4     xmlns="http://www.w3.org/1999/xhtml"
5     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
6     xmlns:xs="http://www.w3.org/2001/XMLSchema"
7     xmlns:fn="http://www.w3.org/2005/xpath-functions"
8     xmlns:csc="http://csclub.uwaterloo.ca/xslt">
9
10 <xsl:function name="csc:term" as="xs:string">
11   <xsl:param name="date" />
12   <xsl:variable name="date_year" as="xs:integer">
13     <xsl:analyze-string select="$date" regex="([0-9]+)-[0-9]+-[0-9]+">
14       <xsl:matching-substring>
15         <xsl:value-of select="regex-group(1)" />
16       </xsl:matching-substring>
17     </xsl:analyze-string>
18   </xsl:variable>
19   <xsl:variable name="date_month" as="xs:integer">
20     <xsl:analyze-string select="$date" regex="[0-9]+-([0-9]+)-[0-9]+">
21       <xsl:matching-substring>
22         <xsl:value-of select="regex-group(1)" />
23       </xsl:matching-substring>
24     </xsl:analyze-string>
25   </xsl:variable>
26   <xsl:variable name="term_text">
27     <xsl:choose>
28       <xsl:when test="$date_month ge 1 and $date_month le 4">Winter </xsl:when>
29       <xsl:when test="$date_month ge 5 and $date_month le 8">Spring </xsl:when>
30       <xsl:when test="$date_month ge 9 and $date_month le 12">Fall </xsl:when>
31     </xsl:choose>
32   </xsl:variable>
33   <xsl:value-of select="concat($term_text, $date_year)" />
34 </xsl:function>
35
36 <xsl:template name="donate-now">
37 <p><a href="/about/donations.html">Donate to Computer Science Club and help us keep on doing what we do</a></p>
38 </xsl:template>
39
40 <xsl:template name="inline-ads">
41 <!-- google ads -->
42 <p>
43   <script type="text/javascript">
44     google_ad_client = "pub-5235744946475097";
45     google_ad_width = 728;
46     google_ad_height = 90;
47     google_ad_format = "728x90_as";
48     google_ad_type = "text_image";
49     //2007-03-21: mcc
50     google_ad_channel = "1106187834";
51   </script>
52   <script type="text/javascript"
53       src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
54     <xsl:text> </xsl:text>
55   </script>
56 </p>
57 </xsl:template>
58
59 </xsl:stylesheet>