Is there a way to alternate table row colors without using the
position() mod 2 trick? I'm in a series of nested xsl:for-each
elements, about 3 deep, and I want to alternate the table row
color all the way through. position() resets to 1 whenever
the inner for-each loops around, of course.
Example code:
<xsl:for-each select="/games/game[count(. | key('platforms', platform)[1]) = 1]">
<xsl:sort select="platform"/>
<xsl:variable name="platform" select="platform"/>
<xsl:for-each select="/games/game[date = $date][region = $region][platform = $platform]">
<xsl:sort select="title"/>
<tr class="???????" bgcolor="???????">
<td>
<xsl:choose>
<xsl:when test="position() = 1"><xsl:value-of select="platform"/></xsl:when>
<xsl:otherwise> </xsl:otherwise>
</xsl:choose>
</td>
<td><a href="{path}/data/{id}.html"><xsl:value-of select="title"/></a></td>
<td><xsl:value-of select="genre"/></td>
</tr>
</xsl:for-each>
</xsl:for-each>
-rs- 2 6160
This can be done in two steps:
Step1:
<xsl:variable name="vrtfMyRows">
<!-- All your processing here but not creating the table --> <xsl:for-each select="/games/game[count(. | key('platforms', platform)[1])
= 1]"> <xsl:sort select="platform"/> <xsl:variable name="platform" select="platform"/> <xsl:for-each select="/games/game[date = $date][region =
$region][platform = $platform]"> <xsl:sort select="title"/>
<xsl:copy-of select="."/> </xsl:for-each> </xsl:for-each>
</xsl:variable>
Step2:
<xsl:for-each select="ext:node-set($vrtfMyRows)/*">
<!-- Produce the table with alternating rows using position() mod 2 -->
</xsl:for-each>
=====
Cheers,
Dimitre Novatchev. http://fxsl.sourceforge.net/ -- the home of FXSL
"Ralph Snart" <sn***@nospam.com> wrote in message
news:sl******************@cluttered.com... Is there a way to alternate table row colors without using the position() mod 2 trick? I'm in a series of nested xsl:for-each elements, about 3 deep, and I want to alternate the table row color all the way through. position() resets to 1 whenever the inner for-each loops around, of course.
Example code:
<xsl:for-each select="/games/game[count(. | key('platforms', platform)[1])
= 1]"> <xsl:sort select="platform"/> <xsl:variable name="platform" select="platform"/> <xsl:for-each select="/games/game[date = $date][region =
$region][platform = $platform]"> <xsl:sort select="title"/> <tr class="???????" bgcolor="???????"> <td> <xsl:choose> <xsl:when test="position() = 1"><xsl:value-of
select="platform"/></xsl:when> <xsl:otherwise> </xsl:otherwise> </xsl:choose> </td> <td><a href="{path}/data/{id}.html"><xsl:value-of
select="title"/></a></td> <td><xsl:value-of select="genre"/></td> </tr> </xsl:for-each> </xsl:for-each>
-rs-
On Sat, 2 Aug 2003 12:15:40 +0200, Dimitre Novatchev <dn********@yahoo.com> wrote: <xsl:for-each select="ext:node-set($vrtfMyRows)/*">
is it possible to do this without ext:node-set? i use sablotron which doesn't
support that extension.
-rs- This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: LRW |
last post by:
Is there some way to make a table have alternating colors for rows when
you're generating the table data with a WHILE statement?
You know, row 1 has a gray BG, row 2 is white, row 3 is gray, 4 is...
|
by: Alistair Birch |
last post by:
Hi
I want rows of a table to appear in alternating background colours. Having looked around the web I can't find any solution apart from waiting for the next version of CSS, so I tried building...
|
by: Matt Kruse |
last post by:
http://www.mattkruse.com/temp/css_expressions.html
One of the standard CSS questions is "how can I shade every other table row
a different color with CSS?"
The answers are usually 1) you can't...
|
by: Max Weebler |
last post by:
Hi,
I have a datagrid built that has an alternating item style that sets the
backcolor and ForeColor of its rows. I have 4 template columns. One of them
has a LinkButton embedded in it to...
|
by: Steve Bottoms |
last post by:
Hi, all!
How does one prevent table cell background colors from alternating between
grey and white? I've dropped a basic table control on an ASP.Net page
(using VB.Net codebehind), and...
|
by: |
last post by:
I'm making admin forms. I'm wondering if there is a way to have the server
programmatically assign alternating colors in a regular table (not a
datalist control). I notice ASP.NET 2 offers a...
|
by: clintw |
last post by:
Hi all,
I've been doing my head in trying to get this to work, but I keep running into a snag. Basically I have a database table with a list of events for the year, with fields for Month, Event...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |