Now use saxon8 instead of cow.

This commit is contained in:
David Bartley 2007-08-11 04:26:38 -04:00
parent 304118de22
commit 21d57fc91b
20 changed files with 139 additions and 305 deletions

View File

@ -1,8 +1,7 @@
INPUTS = index.xml footer.xml
SUBDIRS = about events docs office news users clubs media
# the following two rules are there so cow gets built first.
cow-first: noroot events.ics recurse-cow books.xml members.xml menu.xml all
first: noroot events.ics books.xml members.xml menu.xml all
find ! -regex '.*/\..*' -type f ! -perm -0664 -print0 | xargs -r0 chmod u=rwX,g=rwX,o=rX || true
find ! -regex '.*/\..*' -type d ! -perm 2775 -print0 | xargs -r0 chmod 2775 || true
find ! -regex '.*/\..*' -type d ! -group www -print0 | xargs -r0 chgrp www || true
@ -10,9 +9,6 @@ cow-first: noroot events.ics recurse-cow books.xml members.xml menu.xml all
noroot:
if test $$UID = 0; then echo "don't build as root!"; exit 1; fi
recurse-cow:
cd cow && $(MAKE) && cd ..
members.xml:
echo '<?xml version='\''1.0'\''?>' > $@
echo '<memberlist>' >> $@

4
cow/.gitignore vendored
View File

@ -1,4 +0,0 @@
*.o
/i686
/x86_64
/alpha

View File

@ -1,17 +0,0 @@
ARCH=$(shell uname -m)
MAIN = $(ARCH)/cow
CFLAGS = -I/usr/include/libxml2 -DDEBUG -pedantic -ansi -Wall
LDFLAGS = $(CFLAGS) -lxml2 -lxslt
SOURCES = $(wildcard *.c)
OBJECTS = $(addprefix $(ARCH)/,$(SOURCES:.c=.o))
all: $(MAIN)
$(ARCH):
mkdir -p $(ARCH)
$(MAIN): $(OBJECTS)
$(CC) $(LDFLAGS) -o $@ $(OBJECTS)
$(ARCH)/%.o: %.c $(ARCH)
$(CC) -c $(CFLAGS) -o $@ $<

View File

@ -1 +0,0 @@
requires libxslt to build

View File

@ -1,2 +0,0 @@
#!/bin/sh
exec "$(dirname $0)/$(uname -m)/$(basename $0)" "$@"

View File

@ -1,13 +0,0 @@
#ifndef CSC_COW_DEBUG_H
#define CSC_COW_DEBUG_H
#include <stdio.h>
#ifdef DEBUG
#define DEBUG_PRINT(x) do { fprintf(stderr, "%s:%d (%s): %s\n", __FILE__, \
__LINE__, __FUNCTION__, x); } while (0)
#else
#define DEBUG_PRINT(x) do { } while (0)
#endif
#endif

View File

@ -1,49 +0,0 @@
#include "debug.h"
#include <libxslt/extensions.h>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
#define COW_URI ((const xmlChar *)"http://www.csclub.uwaterloo.ca/cow")
/* return the term ({Winter,Summer,Fall} YYYY) for a date in
* YYYY-MM-DD format.
*/
void extension_cow_term(xmlXPathParserContextPtr ctxt,
int nargs)
{
xmlChar *str, *ret;
int month;
if (nargs != 1) {
xmlXPathSetArityError(ctxt);
}
str = xmlXPathPopString(ctxt);
month = (str[5] - '0')*10 + (str[6] - '0');
ret = xmlUTF8Strndup((const xmlChar*)(month < 9 ? (month < 5 ? "Winter " : "Spring ") : "Fall "), 7);
ret = xmlStrcat(ret, xmlUTF8Strsub(str, 0, 4));
xmlXPathReturnString(ctxt, ret);
xmlFree(str);
}
void *extension_init_func(xsltTransformContextPtr ctxt,
const xmlChar *URI)
{
return 0;
}
void extension_shutdown_func(xsltTransformContextPtr ctxt,
const xmlChar *URI,
void *data)
{
}
void init_extensions()
{
xsltRegisterExtModule(COW_URI,
extension_init_func, extension_shutdown_func);
xsltRegisterExtModuleFunction((const xmlChar*)"term", COW_URI,
extension_cow_term);
}

View File

@ -1,100 +0,0 @@
#include <stdio.h>
#include <string.h>
#include <libxml/xmlmemory.h>
#include <libxml/debugXML.h>
#include <libxml/HTMLtree.h>
#include <libxml/xmlIO.h>
#include <libxml/DOCBparser.h>
#include <libxml/xinclude.h>
#include <libxml/catalog.h>
#include <libxslt/xslt.h>
#include <libxslt/xsltInternals.h>
#include <libxslt/transform.h>
#include <libxslt/xsltutils.h>
#include <libxslt/extensions.h>
#include "debug.h"
extern int xmlLoadExtDtdDefaultValue;
void init_extensions();
/* TODO: check for parse errors */
static int error = 0;
/* output usage message. progname is the name of the executable. */
static void usage(const char* progname)
{
printf("Usage: %s [options] stylesheet input output\n", progname);
printf(" --param name value : pass a parameter to the stylesheet\n");
}
int main(int argc, char** argv)
{
int argNum;
const char **params = 0;
int maxparams = 0;
int nbparams = 0;
xsltStylesheetPtr cur = NULL;
xmlDocPtr doc, res;
FILE *out;
maxparams = 16;
params = (const char**)malloc(sizeof(char*) * maxparams * 2);
if (argc <= 1) {
usage(argv[0]);
return 1;
}
for (argNum = 1; argNum < argc; argNum++) {
if (argv[argNum][0] != '-')
break;
if ((!strcmp(argv[argNum], "-param")) ||
(!strcmp(argv[argNum], "--param"))) {
argNum++;
params[nbparams++] = argv[argNum++];
params[nbparams++] = argv[argNum];
if (nbparams >= maxparams * 2) {
maxparams *= 2;
params = realloc(params, sizeof(char*) * maxparams * 2);
}
} else {
fprintf(stderr, "Unknown option %s\n", argv[argNum]);
usage(argv[0]);
return 1;
}
}
if ((argc - argNum) != 3) {
usage(argv[0]);
return 1;
}
params[nbparams] = NULL;
xmlSubstituteEntitiesDefault(1);
xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
init_extensions();
cur = xsltParseStylesheetFile((const xmlChar *)argv[argNum]);
argNum++;
doc = xmlParseFile(argv[argNum]);
argNum++;
if(!doc)
return 1;
res = xsltApplyStylesheet(cur, doc, params);
if(!res || error)
return 1;
out = fopen(argv[argNum], "w");
if(!out)
return 1;
xsltSaveResultToFile(out, res, cur);
fclose(out);
xsltFreeStylesheet(cur);
xmlFreeDoc(res);
xmlFreeDoc(doc);
xsltCleanupGlobals();
xmlCleanupParser();
return 0;
}

View File

@ -1,8 +1,14 @@
<?xml version='1.0'?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:csc="http://www.csclub.uwaterloo.ca/cow"
extension-element-prefixes="csc">
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:csc="http://www.csclub.uwaterloo.ca/xslt">
<xsl:param name="g_date" required="yes" />
<xsl:param name="g_time" required="yes" />
<xsl:param name="g_pwd" required="yes" />
<xsl:param name="g_root" required="yes" />
<!--
@ -25,6 +31,7 @@
<xsl:output method="xml" encoding="ISO-8859-1" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" />
<!-- include additional style sheets -->
<xsl:include href="./xsl/functions.xsl" />
<xsl:include href="./xsl/common.xsl" />
<xsl:include href="./xsl/directory.xsl" />
<xsl:include href="./xsl/menu.xsl" />

View File

@ -1,12 +1,8 @@
#DEBUG = 1
OUTPUTS=$(INPUTS:.xml=.html)
XSLTARGS=--param date "'`date -I`'" --param time "'`date +%H:%M:%S`'" \
--param pwd "'`pwd`'" --param root "'$(ROOT)'"
ifdef DEBUG
XSLTARGS += -v
endif
XSLTARGS=g_date=`date -I` g_time=`date +%H:%M:%S` \
g_pwd="$$(pwd)" g_root="$(ROOT)"
CLASSPATH=/users/www/saxon8/saxon8.jar
all: $(OUTPUTS)
@for i in $(SUBDIRS) ; do (cd $$i && ($(MAKE) || exit 1) && cd ..) ; done
@ -16,5 +12,5 @@ clean-recurse: clean
clean:
rm -f *.html events.ics
%.html: %.xml $(ROOT)/csc.dtd $(ROOT)/cscweb.xsl $(ROOT)/xsl/*.xsl $(ROOT)/events.xml $(ROOT)/news.xml $(ROOT)/menu.xml $(ROOT)/default.mk directory.xml $(ROOT)/cow/cow
$(ROOT)/cow/cow $(XSLTARGS) $(ROOT)/cscweb.xsl $< $@ || exit 1;
%.html: %.xml $(ROOT)/csc.dtd $(ROOT)/cscweb.xsl $(ROOT)/xsl/*.xsl $(ROOT)/events.xml $(ROOT)/news.xml $(ROOT)/menu.xml $(ROOT)/default.mk directory.xml
java -classpath $(CLASSPATH) net.sf.saxon.Transform $< $(ROOT)/cscweb.xsl $(XSLTARGS) > $@ || exit 1;

View File

@ -1,8 +1,9 @@
<?xml version='1.0'?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:csc="http://www.csclub.uwaterloo.ca/cow"
extension-element-prefixes="csc">
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:csc="http://www.csclub.uwaterloo.ca/xslt">
<xsl:template match="all-books">
<p>The books we currently own include:</p>
@ -11,7 +12,7 @@
<th>Title</th>
<th>Author</th>
</tr>
<xsl:for-each select="document('../books.xml')/booklist/book">
<xsl:for-each select="document(concat($g_root, '/books.xml'))/booklist/book">
<xsl:variable name="class">
<xsl:choose>
<xsl:when test="position() mod 2 = 0">books1</xsl:when>
@ -31,21 +32,17 @@
<xsl:value-of select="@author" />
</td>
</tr>
<xsl:document method="xml" encoding="ISO-8859-1"
<xsl:result-document method="xml" encoding="ISO-8859-1"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
href="{translate(concat($root, '/office/books/', @isbn, '.html'), ' ', '_')}">
href="{translate(concat($g_root, '/office/books/', @isbn, '.html'), ' ', '_')}">
<html>
<head>
<title>Book: <xsl:value-of select="@title" /></title>
<link rel="stylesheet" href="{$pre}default.css" type="text/css" />
</head>
<body><div>
<xsl:call-template name="header">
<xsl:with-param name="title" select="@title" />
<!-- TODO -->
<xsl:with-param name="pwd" select="concat($pwd, '/books')" />
</xsl:call-template>
<xsl:call-template name="header" />
<p>
<b>Title: </b> <xsl:value-of select="@title" /><br />
<b>Edition: </b> <xsl:value-of select="@edition" /><br />
@ -56,7 +53,7 @@
<xsl:call-template name="footer" />
</div></body>
</html>
</xsl:document>
</xsl:result-document>
</xsl:for-each>
</table>
</xsl:template>

View File

@ -1,8 +1,9 @@
<?xml version='1.0'?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:csc="http://www.csclub.uwaterloo.ca/cow"
extension-element-prefixes="csc">
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:csc="http://www.csclub.uwaterloo.ca/xslt">
<xsl:template match="cscpage">
<html>
@ -57,7 +58,7 @@
</div>
<div class="template-header">
<xsl:apply-templates
select="document(concat($pwd, '/directory.xml'))/directory"/>
select="document(concat($g_pwd, '/directory.xml'))/directory"/>
</div>
</xsl:template>
@ -65,8 +66,8 @@
<a href="#pagetop" class="pagetop">Go to top</a>
<div class="footer">
<xsl:call-template name="menu" />
<p>This page was generated on <xsl:value-of select="$date" /> at
<xsl:value-of select="$time" />.</p>
<p>This page was generated on <xsl:value-of select="$g_date" /> at
<xsl:value-of select="$g_time" />.</p>
<p class="infobox">
The overall layout is designed specially for modern browsers. If you
experience any problems, please report them, along with the version of

View File

@ -1,8 +1,9 @@
<?xml version='1.0'?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:csc="http://www.csclub.uwaterloo.ca/cow"
extension-element-prefixes="csc">
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:csc="http://www.csclub.uwaterloo.ca/xslt">
<xsl:template match="directory">
<xsl:variable name="href">
@ -14,7 +15,7 @@
<a class="diritem headdir" href="{$href}">
<xsl:value-of select="@title" />
</a>
<xsl:apply-templates match="diritem" />
<xsl:apply-templates select="diritem" />
</xsl:template>
<xsl:template match="diritem">

View File

@ -1,17 +1,18 @@
<?xml version='1.0'?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:csc="http://www.csclub.uwaterloo.ca/cow"
extension-element-prefixes="csc">
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:csc="http://www.csclub.uwaterloo.ca/xslt">
<xsl:template match="events" name="events">
<tr>
<th colspan="2" class="news">Upcoming Events</th>
</tr>
<xsl:for-each select="document(concat($pwd, '/events.xml'))/eventdefs/eventitem">
<xsl:for-each select="document(concat($g_root, '/events.xml'))/eventdefs/eventitem">
<xsl:sort select="translate(@date, '-', '')"
order="ascending" data-type="number" />
<xsl:if test="translate(@date, '-', '') &gt;= translate($date, '-', '')">
<xsl:if test="translate(@date, '-', '') &gt;= translate($g_date, '-', '')">
<tr>
<td class="eventdate"><xsl:value-of select="@date" /></td>
<td rowspan="2" valign="top" class="eventitem">
@ -36,20 +37,13 @@
</tr>
</xsl:template>
<xsl:template match="events-this-term">
<xsl:call-template name="events-by-term">
<xsl:with-param name="date" select="$date" />
</xsl:call-template>
</xsl:template>
<xsl:template name="events-by-term">
<xsl:param name="date" />
<p>The events for <xsl:value-of select="csc:term($date)" /> are listed here.
<p>The events for <xsl:value-of select="csc:term($g_date)" /> are listed here.
You can also <a href="{$pre}events.ics">download an ICS</a> of them.</p>
<xsl:for-each select="document(concat($pwd, '/../events.xml'))/eventdefs/eventitem">
<xsl:for-each select="document(concat($g_root, '/events.xml'))/eventdefs/eventitem">
<xsl:sort select="translate(@date, '-', '')"
order="ascending" data-type="number" />
<xsl:if test="csc:term(@date) = csc:term($date)">
<xsl:if test="csc:term(@date) = csc:term($g_date)">
<h3><a href="{translate(concat($pre, 'events/', @room, '-', @date, '-', @time, '.html'), ' ', '_')}"><xsl:value-of select="@title" /></a></h3>
<p>
<strong>
@ -68,19 +62,17 @@
</xsl:template>
<xsl:template match="eventitem">
<xsl:document method="xml" encoding="ISO-8859-1"
<xsl:result-document method="xml" encoding="ISO-8859-1"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
href="{translate(concat($root, '/events/', @room, '-', @date, '-', @time, '.html'), ' ', '_')}">
href="{translate(concat($g_root, '/events/', @room, '-', @date, '-', @time, '.html'), ' ', '_')}">
<html>
<head>
<title><xsl:value-of select="@title" /></title>
<link rel="stylesheet" href="{$pre}default.css" type="text/css" />
</head>
<body><div>
<xsl:call-template name="header">
<xsl:with-param name="title" select="@title" />
</xsl:call-template>
<xsl:call-template name="header" />
<h2>Information</h2>
<div>
Held in <xsl:value-of select="@room" />, on
@ -91,44 +83,39 @@
<xsl:call-template name="footer" />
</div></body>
</html>
</xsl:document>
</xsl:result-document>
</xsl:template>
<xsl:template match="generate-event-files">
<xsl:apply-templates select="document(concat($pwd, '/../events.xml'))/eventdefs" />
<xsl:apply-templates select="document(concat($g_root, '/events.xml'))/eventdefs" />
</xsl:template>
<xsl:key name="eventterm" match="/eventdefs/eventitem" use="csc:term(@date)" />
<xsl:template match="old-events">
<xsl:for-each select="document(concat($pwd, '/../events.xml'))/eventdefs/eventitem">
<xsl:for-each select="document(concat($g_root, '/events.xml'))/eventdefs/eventitem">
<xsl:sort select="translate(@date, '-', '')"
order="descending" data-type="number" />
<xsl:if test="not(preceding-sibling::*[csc:term(@date)=csc:term(current()/@date)]) and not(csc:term(@date) = csc:term($date))">
<xsl:if test="not(preceding-sibling::*[csc:term(@date)=csc:term(current()/@date)]) and not(csc:term(@date) = csc:term($g_date))">
<p><a href="{translate(concat('old-',csc:term(@date), '.html'), ' ', '_')}">
<xsl:value-of select="csc:term(@date)" />
</a></p>
<xsl:document method="xml" encoding="ISO-8859-1"
<xsl:result-document method="xml" encoding="ISO-8859-1"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
href="{translate(concat($root, '/events/old-', csc:term(@date), '.html'), ' ', '_')}">
href="{translate(concat($g_root, '/events/old-', csc:term(@date), '.html'), ' ', '_')}">
<html>
<head>
<title>Events for <xsl:value-of select="csc:term(@date)" /></title>
<link rel="stylesheet" href="{$pre}default.css" type="text/css" />
</head>
<body><div>
<xsl:call-template name="header">
<xsl:with-param name="title"
select="concat('Events for ', csc:term(@date))" />
</xsl:call-template>
<xsl:call-template name="events-by-term">
<xsl:with-param name="date" select="@date" />
</xsl:call-template>
<xsl:call-template name="header" />
<xsl:call-template name="events-by-term" />
<xsl:call-template name="footer" />
</div></body>
</html>
</xsl:document>
</xsl:result-document>
</xsl:if>
</xsl:for-each>
</xsl:template>

View File

@ -1,8 +1,9 @@
<?xml version='1.0'?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:csc="http://www.csclub.uwaterloo.ca/cow"
extension-element-prefixes="csc">
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:csc="http://www.csclub.uwaterloo.ca/xslt">
<xsl:template match="execlist">
<h3>Elected positions</h3>

34
xsl/functions.xsl Normal file
View File

@ -0,0 +1,34 @@
<?xml version='1.0'?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:csc="http://www.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:stylesheet>

View File

@ -1,8 +1,9 @@
<?xml version='1.0'?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:csc="http://www.csclub.uwaterloo.ca/cow"
extension-element-prefixes="csc">
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:csc="http://www.csclub.uwaterloo.ca/xslt">
<xsl:template match="mediafile">
<xsl:param name="ext" />
@ -12,7 +13,7 @@
<xsl:template match="flvfile">
<xsl:param name="mirror" />
<script type="text/javascript" src="flash/swfobject.js"></script>
<script type="text/javascript" src="flash/swfobject.js"><xsl:text> </xsl:text></script>
<p id="player1"><a href="http://www.macromedia.com/go/getflashplayer">
Get the Flash Player</a> to see this video using Flash Player.</p>
<script type="text/javascript">
@ -27,19 +28,17 @@
</xsl:template>
<xsl:template match="mediaitem">
<xsl:document method="xml" encoding="ISO-8859-1"
<xsl:result-document method="xml" encoding="ISO-8859-1"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
href="{translate(concat($root, '/media/', @title , '.html'), ' ', ' ')}">
href="{translate(concat($g_root, '/media/', @title , '.html'), ' ', ' ')}">
<html>
<head>
<title><xsl:value-of select="@title" /></title>
<link rel="stylesheet" href="{$pre}default.css" type="text/css" />
</head>
<body><div>
<xsl:call-template name="header">
<xsl:with-param name="title" select="@title" />
</xsl:call-template>
<xsl:call-template name="header" />
<xsl:if test="abstract">
<h2>Abstract</h2>
<div>
@ -91,11 +90,11 @@
<xsl:if test="@buttons">
<br/><br/>
<!-- digg button -->
<script src="http://digg.com/tools/diggthis.js"
type="text/javascript" />
<script src="http://digg.com/tools/diggthis.js"
type="text/javascript"><xsl:text> </xsl:text></script>
<!-- reddit button -->
<script type="text/javascript"
src="http://reddit.com/button.js?t=3" />
src="http://reddit.com/button.js?t=3"><xsl:text> </xsl:text></script>
</xsl:if>
<xsl:if test="other">
<div>
@ -110,7 +109,7 @@
addthis_pub = 'calumt';
</script>
<script type="text/javascript"
src="http://s7.addthis.com/js/addthis_widget.php?v=12" />
src="http://s7.addthis.com/js/addthis_widget.php?v=12"><xsl:text> </xsl:text></script>
<!-- google ads -->
<!--
<script type="text/javascript">
@ -123,12 +122,12 @@
google_ad_channel = "1106187834";
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js" />
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"><xsl:text> </xsl:text></script>
-->
<xsl:call-template name="footer" />
</div></body>
</html>
</xsl:document>
</xsl:result-document>
<li><a href= "{@title}.html"><xsl:value-of select="@title" /></a></li>
</xsl:template>

View File

@ -1,13 +1,14 @@
<?xml version='1.0'?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:csc="http://www.csclub.uwaterloo.ca/cow"
extension-element-prefixes="csc">
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:csc="http://www.csclub.uwaterloo.ca/xslt">
<xsl:template match="members-this-term">
<p>The members for <xsl:value-of select="csc:term($date)" /> are
<p>The members for <xsl:value-of select="csc:term($g_date)" /> are
listed here. We currently have
<xsl:value-of select="count(document('../members.xml')/memberlist/member)" />
<xsl:value-of select="count(document(concat($g_root, '/members.xml'))/memberlist/member)" />
members.</p>
<table>
<tr>
@ -15,7 +16,7 @@
<th>Program</th>
<th>Userid</th>
</tr>
<xsl:for-each select="document('../members.xml')/memberlist/member">
<xsl:for-each select="document(concat($g_root, '/members.xml'))/memberlist/member">
<xsl:variable name="class">
<xsl:choose>
<xsl:when test="position() mod 2 = 0">members1</xsl:when>

View File

@ -1,8 +1,9 @@
<?xml version='1.0'?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:csc="http://www.csclub.uwaterloo.ca/cow"
extension-element-prefixes="csc">
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:csc="http://www.csclub.uwaterloo.ca/xslt">
<xsl:template match="menuitem">
<xsl:variable name="pre2">
@ -26,7 +27,7 @@
</xsl:template>
<xsl:template match="menu" name="menu">
<xsl:apply-templates select="document('../menu.xml')/menudefs" />
<xsl:apply-templates select="document(concat($g_root, '/menu.xml'))/menudefs" />
</xsl:template>
</xsl:stylesheet>

View File

@ -1,13 +1,14 @@
<?xml version='1.0'?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:csc="http://www.csclub.uwaterloo.ca/cow"
extension-element-prefixes="csc">
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:csc="http://www.csclub.uwaterloo.ca/xslt">
<xsl:template match="newsdefs">
<xsl:apply-templates select="newsitem[csc:term(@date) = csc:term($date)]">
<xsl:sort select="translate(@date, '-', '')"
order="descending" data-type="number" />
<xsl:apply-templates select="newsitem[csc:term(@date) = csc:term($g_date)]">
<xsl:sort select="translate(@date, '-', '')"
order="descending" data-type="number" />
</xsl:apply-templates>
</xsl:template>
@ -25,7 +26,7 @@
<tr>
<th colspan="2" class="news">News</th>
</tr>
<xsl:apply-templates select="document('../news.xml')/newsdefs" />
<xsl:apply-templates select="document(concat($g_root, '/news.xml'))/newsdefs" />
<tr>
<td class="newsitem" colspan="2">
<a href="news/">Older news items</a> are available. Make sure you check
@ -37,9 +38,10 @@
</tr>
</xsl:template>
<xsl:template match="news-this-term" name="news-by-term">
<xsl:template name="news-by-term">
<xsl:param name="date" />
<p>The news for <xsl:value-of select="csc:term($date)" /> is listed here.</p>
<xsl:for-each select="document('../news.xml')/newsdefs/newsitem">
<xsl:for-each select="document(concat($g_root, '/news.xml'))/newsdefs/newsitem">
<xsl:sort select="translate(@date, '-', '')"
order="descending" data-type="number" />
<xsl:if test="csc:term(@date) = csc:term($date)">
@ -57,34 +59,31 @@
<xsl:key name="newsterm" match="/newsdefs/newsitem" use="csc:term(@date)" />
<xsl:template match="old-news">
<xsl:for-each select="document('../news.xml')/newsdefs/newsitem">
<xsl:for-each select="document(concat($g_root, '/news.xml'))/newsdefs/newsitem">
<xsl:sort select="translate(@date, '-', '')"
order="descending" data-type="number" />
<xsl:if test="not(preceding-sibling::*[csc:term(@date)=csc:term(current()/@date)]) and not(csc:term(@date) = csc:term($date))">
<xsl:if test="not(preceding-sibling::*[csc:term(@date)=csc:term(current()/@date)]) and not(csc:term(@date) = csc:term($g_date))">
<p><a href="{translate(concat('old-', csc:term(@date), '.html'), ' ', '_')}">
<xsl:value-of select="csc:term(@date)" />
</a></p>
<xsl:document method="xml" encoding="ISO-8859-1"
<xsl:result-document method="xml" encoding="ISO-8859-1"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
href="{translate(concat($root, '/news/old-', csc:term(@date), '.html'), ' ', '_')}">
href="{translate(concat($g_root, '/news/old-', csc:term(@date), '.html'), ' ', '_')}">
<html>
<head>
<title>News for <xsl:value-of select="csc:term(@date)" /></title>
<link rel="stylesheet" href="{$pre}default.css" type="text/css" />
</head>
<body><div>
<xsl:call-template name="header">
<xsl:with-param name="title"
select="concat('News for ', csc:term(@date))" />
</xsl:call-template>
<xsl:call-template name="header" />
<xsl:call-template name="news-by-term">
<xsl:with-param name="date" select="@date" />
</xsl:call-template>
<xsl:call-template name="footer" />
</div></body>
</html>
</xsl:document>
</xsl:result-document>
</xsl:if>
</xsl:for-each>
</xsl:template>