Static website for local motocross track (circa Jun 2004)
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
|
|
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:x="http://www.w3.org/1999/xhtml" exclude-result-prefixes="x"> <xsl:output method="xml" version="1.0" encoding="iso-8859-1" indent="yes"/>
<xsl:key name="entry_list" match="x:tr[x:td[2][@align][not(. = 'Number')]]" use="preceding-sibling::x:tr[x:td[1][not(@align)][not(. = 'Race Results')]][1]/x:td[1]"/>
<xsl:variable name="entries" select="count(//x:tr[x:td[2][@align][not(. = 'Number')]])"/> <xsl:variable name="classes" select="count(//x:tr[x:td[1][not(@align)][not(. = 'Race Results')]])"/>
<xsl:template match="/"> <xsl:apply-templates select="//x:table"/> </xsl:template>
<xsl:template match="x:table"> <xsl:element name="race"> <xsl:attribute name="date"><xsl:value-of select="x:tr[3]/x:th[1]"/></xsl:attribute> <xsl:attribute name="name"><xsl:value-of select="x:tr[2]/x:th[1]"/></xsl:attribute> <xsl:attribute name="entries"><xsl:value-of select="$entries"/></xsl:attribute> <xsl:attribute name="classes"><xsl:value-of select="$classes"/></xsl:attribute> <xsl:call-template name="class_handler"> <xsl:with-param name="class_list" select="x:tr/x:td[1][not(@align)][not(. = 'Race Results')]"/> </xsl:call-template> </xsl:element> </xsl:template>
<xsl:template name="class_handler"> <xsl:param name="class_list"/> <xsl:for-each select="$class_list"> <xsl:element name="class"> <xsl:attribute name="name"><xsl:value-of select="."/></xsl:attribute> <xsl:call-template name="class_entries"> <xsl:with-param name="entries" select="key('entry_list', . )"/> </xsl:call-template> </xsl:element> </xsl:for-each> </xsl:template>
<xsl:template name="class_entries"> <xsl:param name="entries"/> <xsl:for-each select="$entries"> <xsl:sort select="x:td[1]" data-type="number" lang="C"/> <xsl:element name="entry"> <xsl:attribute name="name"><xsl:value-of select="x:td[5]"/></xsl:attribute> <xsl:attribute name="from"><xsl:value-of select="x:td[6]"/></xsl:attribute> <xsl:element name="bike"> <xsl:attribute name="brand"><xsl:value-of select="x:td[3]"/></xsl:attribute> <xsl:attribute name="number"><xsl:value-of select="x:td[2]"/></xsl:attribute> </xsl:element> <xsl:element name="moto1"> <xsl:attribute name="finish"><xsl:value-of select="x:td[7]"/></xsl:attribute> </xsl:element> <xsl:element name="moto2"> <xsl:attribute name="finish"><xsl:value-of select="x:td[8]"/></xsl:attribute> </xsl:element> <xsl:element name="overall"> <xsl:attribute name="finish"><xsl:value-of select="x:td[1]"/></xsl:attribute> <xsl:attribute name="points"><xsl:value-of select="x:td[11]"/></xsl:attribute> </xsl:element> </xsl:element> </xsl:for-each> </xsl:template>
</xsl:stylesheet>
|