p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   XSLT (http://p2p.wrox.com/forumdisplay.php?f=86)
-   -   document node order vs sort node order. (http://p2p.wrox.com/showthread.php?t=142)

ladyslipper98201 June 4th, 2003 07:20 PM

document node order vs sort node order.
So I am grouping nodes by predicate on an attribute and sorted the nodes based on another attribute. I put these nodes into lines in a table. I want to have the lines in the table have alternating background colors. When I use xsl:number that returns the document order # of the node but what I want is the number of the node in the grouped & sorted order - otherwise the colors don't alternate they are just lumped together in pre-sorted/pre-grouped order.

How do I go about that?

Here is the grouping example,

<th>Method Stats</th>
<xsl:apply-templates select="Metric[Values/@per='method']">
     <xsl:sort select="Values/@total" data-type="number" order="descending"/>



pgtips June 5th, 2003 09:33 AM

try the position() function instead, it reflects the sorted order. I assume you're trying to do something like this:
<xsl:element name="tr">
<xsl:if test="position() mod 2 = 0">
   <xsl:attribute name="class">even</xsl:attribute>


ladyslipper98201 June 5th, 2003 11:06 AM

Yeah that was exactly what I was doing. Thanks for the help.

All times are GMT -4. The time now is 06:08 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.