Is it possible to alternate colored rows in the results page?

Yes. In the default.xsl file, replace the existing template for the "results" section with the following code:

Code:
@@@
<xsl:template name="results">
<table cellSpacing="0" align="center" width="80%" border="0" cellPadding="0">
<xsl:if test="//results/@hits=0">

<tr>
<td><br/>
Your search for <b><xsl:value-of select="//results/@query"/></b> did not match any documents.<br/>
<br/>
Suggestions:<br/>
- Make sure all words are spelled correctly.<br/>
- Use similar words or synonyms.<br/>
- Try more general keywords.<br/>
<br/>
</td>
</tr>


</xsl:if>
<xsl:for-each select="//result">

<xsl:if test="@no mod 2=0">
<tr bgcolor="#dedede">
<td>
<a href="{url}">
<xsl:apply-templates select="title"/>
</a>
<br/>
<xsl:choose>
<xsl:when test="context">
...<xsl:apply-templates select="context"/>...
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="description"/>
</xsl:otherwise>
</xsl:choose>
<br/>
<xsl:value-of select="url"/>
<br/>
<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
<br/>
<br/>
</td>
<td width="20%" vAlign="top">
<p align="right">
<xsl:value-of select="score"/>%
</p>
</td>
</tr>
</xsl:if>

<xsl:if test="@no mod 2=1">
<tr bgcolor="#ffffff">
<td>
<a href="{url}">
<xsl:apply-templates select="title"/>
</a>
<br/>
<xsl:choose>
<xsl:when test="context">
...<xsl:apply-templates select="context"/>...
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="description"/>
</xsl:otherwise>
</xsl:choose>
<br/>
<xsl:value-of select="url"/>
<br/>
<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
<br/>
<br/>
</td>
<td width="20%" vAlign="top">
<p align="right">
<xsl:value-of select="score"/>%
</p>
</td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
</xsl:template>
@@@

Have more questions? Submit a request

Comments