<?xml version="1.0"?>
<!--
  torrentdb - Copyright (C) 2004 - r00t
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2, or (at your option)
  any later version.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xsl:version="1.0">

<xsl:output method="text"/>

  <!-- store for later use -->
  <xsl:variable name="time" select="torrentdb/time"/>

  <!-- output list of torrents -->
  <xsl:template match="torrents"><xsl:for-each select="torrent"><xsl:value-of select="link"/><xsl:text>
</xsl:text><xsl:value-of select="name"/> (<xsl:number value="size" grouping-size="3" grouping-separator="."/> bytes, <xsl:if test="updated"><xsl:if test="seeds"><xsl:value-of select="seeds"/>/<xsl:value-of select="peers"/>(seeds/peers), updated<xsl:value-of select="format-number(($time - updated) div 60 ,'#')"/> mins ago</xsl:if><xsl:if test="not(seeds) and status"><xsl:value-of select="status"/>, <xsl:value-of select="format-number(($time - updated) div 60 ,'#')"/> mins ago</xsl:if></xsl:if><xsl:if test="not(updated)">no stats yet</xsl:if>)<xsl:text>
</xsl:text></xsl:for-each>
  </xsl:template>
 
  <!-- MAIN -->
  <xsl:template match="/torrentdb"><xsl:value-of select="next"/><xsl:text>
</xsl:text><xsl:apply-templates select="torrents"/></xsl:template>
  
  <xsl:template match="*"><xsl:comment>warning, default template was used</xsl:comment></xsl:template>



</xsl:stylesheet>
