P
Peter van Schie
Hi all,
I'm writing a searchinterface on a mysql database in PHP. I retrieve
the searchoutput and write it to an XML file, which is then being
displayed in the webbrowser. I'm using XSLT to process the XML file and
to output HTML.
So far so good, but now I want to switch the background color for each
resultrow.
So resultrow 1 should have say background color white, resultrow 2
grey, resultrow 3 white again and so on.
The relevant part of my XSLT looks like this:
<table class="searchresults">
<xsl:for-each select="result/document">
<tr><td colspan="3"><strong><a href="viewfulldoc.php"><xsl:value-of
select="dossiernaam"/></a></strong></td></tr>
<tr><td colspan="3" class="preview"><xsl:value-of
select="fulltext"/></td></tr>
<tr>
<td><xsl:value-of select="documenttype"/></td>
<td><xsl:value-of select="organisatie"/></td>
<td><xsl:value-of select="invoerdatum"/></td>
</tr>
</xsl:for-each>
</table>
I'd somehow like to keep track of a rowcounter to know if it's an odd
or even row, but how would I do something like that in XSLT.
I'm obviously new to XSLT, so please bear with me.
Thanks in advance.
Kind regards,
Peter.
I'm writing a searchinterface on a mysql database in PHP. I retrieve
the searchoutput and write it to an XML file, which is then being
displayed in the webbrowser. I'm using XSLT to process the XML file and
to output HTML.
So far so good, but now I want to switch the background color for each
resultrow.
So resultrow 1 should have say background color white, resultrow 2
grey, resultrow 3 white again and so on.
The relevant part of my XSLT looks like this:
<table class="searchresults">
<xsl:for-each select="result/document">
<tr><td colspan="3"><strong><a href="viewfulldoc.php"><xsl:value-of
select="dossiernaam"/></a></strong></td></tr>
<tr><td colspan="3" class="preview"><xsl:value-of
select="fulltext"/></td></tr>
<tr>
<td><xsl:value-of select="documenttype"/></td>
<td><xsl:value-of select="organisatie"/></td>
<td><xsl:value-of select="invoerdatum"/></td>
</tr>
</xsl:for-each>
</table>
I'd somehow like to keep track of a rowcounter to know if it's an odd
or even row, but how would I do something like that in XSLT.
I'm obviously new to XSLT, so please bear with me.
Thanks in advance.
Kind regards,
Peter.