|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: sorting - lost in a maze
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@xxxxxxxxxx - email -----Original Message----- From: Jason Tripanier <jtrepanier@xxxxxxxxxxx> Sent: Fri, 11 Mar 2005 10:09:42 -0500 To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: 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.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








