Fix up grammar on donation link and page
[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>Please consider <a href="{$g_pre}about/donations.html">donating to the
38 Computer Science Club</a> to help offset the costs of bringing you our
39 talks.</p>
40 </xsl:template>
41
42 <xsl:template name="inline-ads">
43 <!-- google ads -->
44 <p>
45   <script type="text/javascript">
46     google_ad_client = "pub-5235744946475097";
47     google_ad_width = 728;
48     google_ad_height = 90;
49     google_ad_format = "728x90_as";
50     google_ad_type = "text_image";
51     //2007-03-21: mcc
52     google_ad_channel = "1106187834";
53   </script>
54   <script type="text/javascript"
55       src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
56     <xsl:text> </xsl:text>
57   </script>
58 </p>
59 </xsl:template>
60
61 </xsl:stylesheet>