How do I add a number to each search result in regular search default.xsl?

To add a number to each search result, locate
<xsl:template name="results">

in default.xsl and add the line 
<xsl:value-of select="@no"/>
as shown below.


<xsl:template name="results">
<table cellSpacing="0" align="center" width="80%" border="0" cellPadding="0">
<xsl:if test="//results/@hits=0">
Your search for <b><xsl:value-of select="//results/@query"/></b> did not match any documents.<br/>
- Make sure all words are spelled correctly.<br/>
- Use similar words or synonyms.<br/>
- Try more general keywords.<br/>
<xsl:for-each select="//result">

<!-- Add this for Result Numbering -->

<xsl:value-of select="@no"/>.

<!-- Numbering Ends -->

<a href="{url}">
<xsl:apply-templates select="title"/>
<xsl:when test="context">
...<xsl:apply-templates select="context"/>...
<xsl:apply-templates select="description"/>
<xsl:value-of select="url"/>
<xsl:value-of select="substring(lastmodified, 3, 5)"/>
<xsl:value-of select="substring(lastmodified, 0, 3)"/>
<xsl:text>, </xsl:text>
<xsl:value-of select="substring(lastmodified, 7, 6)"/>
<xsl:text> - </xsl:text>
<xsl:value-of select="round(size div 1024)"/>k
<td width="20%" vAlign="top">
<p align="right">
<xsl:value-of select="score"/>%

To learn more about SearchBlox please visit our developer document site

Have more questions? Submit a request