old-website/xsl/functions.xsl

62 lines
2.0 KiB
XML

<?xml version='1.0'?>
<xsl:stylesheet version="2.0"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:csc="http://csclub.uwaterloo.ca/xslt">
<xsl:function name="csc:term" as="xs:string">
<xsl:param name="date" />
<xsl:variable name="date_year" as="xs:integer">
<xsl:analyze-string select="$date" regex="([0-9]+)-[0-9]+-[0-9]+">
<xsl:matching-substring>
<xsl:value-of select="regex-group(1)" />
</xsl:matching-substring>
</xsl:analyze-string>
</xsl:variable>
<xsl:variable name="date_month" as="xs:integer">
<xsl:analyze-string select="$date" regex="[0-9]+-([0-9]+)-[0-9]+">
<xsl:matching-substring>
<xsl:value-of select="regex-group(1)" />
</xsl:matching-substring>
</xsl:analyze-string>
</xsl:variable>
<xsl:variable name="term_text">
<xsl:choose>
<xsl:when test="$date_month ge 1 and $date_month le 4">Winter </xsl:when>
<xsl:when test="$date_month ge 5 and $date_month le 8">Spring </xsl:when>
<xsl:when test="$date_month ge 9 and $date_month le 12">Fall </xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="concat($term_text, $date_year)" />
</xsl:function>
<xsl:template name="donate-now">
<p>Please consider <a href="{$g_pre}about/donations.html">donating to the
Computer Science Club</a> to help offset the costs of bringing you our
talks.</p>
</xsl:template>
<xsl:template name="inline-ads">
<!-- google ads -->
<p>
<script type="text/javascript">
google_ad_client = "pub-5235744946475097";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
//2007-03-21: mcc
google_ad_channel = "1106187834";
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
<xsl:text> </xsl:text>
</script>
</p>
</xsl:template>
</xsl:stylesheet>