Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 4th, 2003, 07:20 PM
Registered User
 
Join Date: Jun 2003
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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"/>
</xsl:apply-templates>


Thanks,

JJ
Reply With Quote
  #2 (permalink)  
Old June 5th, 2003, 09:33 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

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>
</xsl:if>
...
</xsl:element>

hth
Phil
Reply With Quote
  #3 (permalink)  
Old June 5th, 2003, 11:06 AM
Registered User
 
Join Date: Jun 2003
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
TreeView and SiteMap Node Order robzyc ASP.NET 1.0 and 1.1 Basics 0 May 19th, 2008 04:27 AM
Dynamic sort order or sort datatype kapy_kal XSLT 2 September 18th, 2007 02:10 PM
Order of node parsing freddy XSLT 2 January 18th, 2007 03:12 PM
sort recordset in different order pablohoney Classic ASP Databases 0 December 29th, 2005 08:32 PM
Sort order Question Tere Crystal Reports 1 February 14th, 2005 03:18 PM



All times are GMT -4. The time now is 06:40 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.