<?xml version="1.0"?> 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="html">

  <xsl:template match="/top">
    <html><body>
      <xsl:apply-templates mode="short" select="mail[@priority!='zero']"/>
    <p/>
    Number of mails: <xsl:value-of select="count(/top/mail)"/>
    <br/>
    Number of low-priority mails (not displayed in summary):
    <xsl:value-of select="count(/top/mail[@priority='zero'])"/>
      <xsl:apply-templates mode="long"/>
    <hr/>
    </body></html>
  </xsl:template>

  <xsl:template match="mail" mode="short">
     <xsl:value-of select="header/from"/>
     to <xsl:value-of select="header/to"/>:
     <xsl:value-of select="header/subject"/>
     (<a>
       <xsl:attribute name="href">#M<xsl:number value="position()"/></xsl:attribute>Jump</a>)
     <br/>
  </xsl:template>


  <xsl:template match="mail" mode="long">
     <hr/>
     <a>
       <xsl:attribute name="name">M<xsl:number value="position()"/></xsl:attribute>
     </a>
     From: <xsl:value-of select="header/from"/> <br/>
     To: <xsl:value-of select="header/to"/> <br/>
     Subject: <xsl:value-of select="header/subject"/><p/><PRE>
     <xsl:value-of select="body"/></PRE>
     <br/>
  </xsl:template>


  </xsl:output>
</xsl:stylesheet>
