<?xml version=
"1.0"
?>
<!-- Generate a list of all episodes, with links to the seasons' pages -->
<xsl:stylesheet
version="
1.0
"
xmlns:xsl="
http://www.w3.org/1999/XSL/Transform
"
>
<xsl:output
encoding="
ISO-8859-1
"
method="
html
"
/>
<!-- generate the main framework for the page -->
<xsl:template
match="
/series
"
>
<html
>
<head
>
<title
>
<xsl:value-of
select="
title
"
/>
</title>
<link
href="
series.css
"
rel="
stylesheet
"
/>
</head>
<body
>
<h1
align="
center
"
>
<xsl:value-of
select="
title
"
/>
</h1>
<hr
/>
<!-- generate a quick link list to each season -->
<table
width="
100%
"
>
<tr
>
<xsl:for-each
select="
episodes/season
"
>
<td
align="
center
"
>
<a
href="
#{@id}
"
>
Season
<xsl:value-of
select="
@id
"
/>
</a>
</td>
</xsl:for-each>
</tr>
</table>
<xsl:apply-templates
select="
episodes
"
/>
</body>
</html>
</xsl:template>
<!-- generate the list of all episodes -->
<xsl:template
match="
episodes
"
>
<xsl:apply-templates
/>
</xsl:template>
<xsl:template
match="
season
"
>
<hr
/>
<h2
>
<a
name="
{@id}
"
>
Season
<xsl:value-of
select="
@id
"
/>
</a>
</h2>
<table
cellpadding="
3pt
"
width="
100%
"
>
<xsl:apply-templates
/>
</table>
</xsl:template>
<xsl:template
match="
episode
"
>
<xsl:variable
name="
rowcolor
"
>
<xsl:choose
>
<xsl:when
test="
(@id mod 2) = 0
"
>
col1
</xsl:when>
<xsl:otherwise
>
col2
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<tr
class="
{$rowcolor}
"
>
<td
align="
right
"
width="
10%
"
>
<xsl:value-of
select="
@id
"
/>
</td>
<td
>
<a
href="
season{../@id}.html#{@id}
"
>
<xsl:value-of
select="
title
"
/>
</a>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>