<?xml version="1.0"?>

<!-- Generate some statistics about the series -->

<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="/">
    
<html>
      
<head>
        
<title><xsl:value-of select="series/title" /></title>
        
<link href="series.css" rel="stylesheet" />
      
</head>
      
<body>
        
<h1 align="center"><xsl:value-of select="series/title" /></h1>

        
<hr />

        
<xsl:apply-templates select="series" />

      
</body>
    
</html>
  
</xsl:template>



  
<!-- generate some statistics about the series -->
  
<xsl:template match="series">
    
<!-- some information about the epsiodes -->
    
<p>
      This series spans
      
<a href="episodes.html">
        
<xsl:value-of select="count(episodes/season)" /> seasons with
        
<xsl:value-of select="count(episodes/season/episode)" />
        episodes
</a>:
    
</p>
    
<!-- and generate a list of quick links -->
    
<table width="100%">
      
<xsl:for-each select="episodes/season">
        
<xsl:variable name="link">season<xsl:value-of select="@id" />.html</xsl:variable>
        
<tr>
          
<td align="left">
            
<a href="{$link}">Season <xsl:value-of select="@id" />:</a>
          
</td>
          
<xsl:for-each select="episode">
            
<td align="center">
              
<a href="{$link}#{@id}"><xsl:value-of select="@id" /></a>
            
</td>
          
</xsl:for-each>
        
</tr>
      
</xsl:for-each>
    
</table>
    
<!-- and some info on the actors -->
    
<p>
      This series features
      
<a href="actors.html#regular">
        
<xsl:value-of select="count(maincast/member)" /> regular roles</a>,
      
<a href="actors.html#recurring">
        
<xsl:value-of select="count(recurring/member)" /> actors in
        recurring roles
</a> and
      
<a href="actors.html#guest">
        
<xsl:value-of select="count(episodes/season/episode/cast/member[not(actor)])" />
        actors in guest roles
</a>.
    
</p>
  
</xsl:template>

</xsl:stylesheet>