I simplified your output a little by using the <xsl:choose> construct to set
the class attribute for alternating rows rather than trying to concatenate a class
name to a string as you have.
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" />
<xsl:strip-space elements="*" />
<xsl:param name="keyword" select="'Agrotourisme'" />
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="fiches">
<table>
<xsl:for-each select="fiche[texte/cattouristique=$keyword]">
<xsl:sort order="descending" select="texte/fichetitre"/>
<xsl:apply-templates select="." />
</xsl:for-each>
</table>
</xsl:template>
<xsl:template match="fiche">
<xsl:choose>
<xsl:when test="count(preceding-sibling::fiche) mod 2 = 0">
<tr class="even-row-color"><td><xsl:value-of select="texte/fichetitre" /></td><td><xsl:value-of select="texte/typeheberg"
/></td><td>123</td><td><xsl:value-of select="region/regionnseo" /></td></tr>
</xsl:when>
<xsl:otherwise>
<tr class="odd-row-color"><td><xsl:value-of select="texte/fichetitre" /></td><td><xsl:value-of select="texte/typeheberg"
/></td><td>123</td><td><xsl:value-of select="region/regionnseo" /></td></tr>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
--
Charles Knell
cknell(_at_)onebox(_dot_)com - email
-----Original Message-----
From: Jason Trépanier <jtrepanier(_at_)cforp(_dot_)on(_dot_)ca>
Sent: Fri, 11 Mar 2005 10:09:42 -0500
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] sorting - lost in a maze
I am trying to get records out of an xml file that match a $parameter givin.
for example the parameter must search "cattouristique" for "Agrotourisme"
and then the records that match "Agrotourisme" are returned.
Also the records returned must have alternating row colors.
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--