<?xml version="1.0" ?> 
<xsl:stylesheet version="1.0" xmlns:yahoo="urn:yahoo:srch" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" />
<xsl:param name="offset">0</xsl:param>
<xsl:param name="start">-1</xsl:param>
<xsl:param name="end" >9999999</xsl:param>
<xsl:param name="emptyrows">0</xsl:param>
<!-- note that we cannot use /yahoo:ResultSet/yahoo:Result since we used the options.xpath to preselect the resultset -->
<xsl:template match="/">
  <xsl:call-template name="emptyrow"><xsl:with-param name="repeat" select="-$emptyrows" /></xsl:call-template>
  <xsl:apply-templates select="/*/yahoo:Result[position() &gt; $start and position() &lt;= $end]" />
  <xsl:call-template name="emptyrow"><xsl:with-param name="repeat" select="$emptyrows" /></xsl:call-template>
</xsl:template>

<xsl:template match="yahoo:Result">
   <div class="searchResult">
      <div class="position"><xsl:value-of select="$offset + position()" /></div>
      <a class="permlink" href="{yahoo:ClickUrl}"><h2><xsl:value-of select="substring(yahoo:Title, 0, 60)" /></h2></a>
      <div class="summary"><xsl:value-of select="substring(yahoo:Summary, 0, 120)" /></div>
      <a class="permlink" href="{yahoo:ClickUrl}"><xsl:value-of select="substring(yahoo:Url, 0, 60)" /></a>
      <xsl:apply-templates select="yahoo:Cache" />
   </div>
</xsl:template>

<xsl:template match="yahoo:Cache">
  - <xsl:value-of select="yahoo:Size" /> - <a href="{yahoo:Url}">Cache</a>
</xsl:template>

<xsl:template name="emptyrow">
  <xsl:param name="repeat">0</xsl:param>
  <xsl:if test="number($repeat) >= 1">
    <div class="searchResult">&#160;</div>
    <xsl:call-template name="emptyrow"><xsl:with-param name="repeat" select="$repeat -1" /></xsl:call-template>
  </xsl:if>
</xsl:template>

</xsl:stylesheet>

