RE: [xsl] sorting - lost in a maze

Subject: RE: [xsl] sorting - lost in a maze
From: cknell@xxxxxxxxxx
Date: Fri, 11 Mar 2005 11:24:34 -0500
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="";>
 <xsl:output method="xml" indent="yes" />
 <xsl:strip-space elements="*" />

<xsl:param name="keyword" select="'Agrotourisme'" />

 <xsl:template match="/">
   <xsl:apply-templates />

 <xsl:template match="fiches">
   <xsl:for-each select="fiche[texte/cattouristique=$keyword]">
     <xsl:sort order="descending" select="texte/fichetitre"/>
     <xsl:apply-templates select="." />

 <xsl:template match="fiche">
     <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>
       <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>

Charles Knell
cknell@xxxxxxxxxx - email

-----Original Message-----
From:     Jason Tripanier <jtrepanier@xxxxxxxxxxx>
Sent:     Fri, 11 Mar 2005 10:09:42 -0500
To:       xsl-list@xxxxxxxxxxxxxxxxxxxxxx
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.

Current Thread