<?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:template match="members-this-term">
  <p>The members for <xsl:value-of select="csc:term($g_date)" /> are
    listed here. We currently have 
    <xsl:value-of select="count(document(concat($g_root, '/members.xml'))/memberlist/member)" /> 
    members.</p>
  <table>
    <tr>
      <th>Name</th>
      <th>Program</th>
      <th>Userid</th>
    </tr>
    <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>
          <xsl:otherwise>members2</xsl:otherwise>
        </xsl:choose>
      </xsl:variable>
      <tr class="{$class}">
        <td><xsl:value-of select="@name" /></td>
        <td><xsl:value-of select="@program" /></td>
        <td><xsl:value-of select="@userid" /></td>
      </tr>
    </xsl:for-each>
  </table>
</xsl:template>

</xsl:stylesheet>
