This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes XSLT and HTML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XSLT and HTML" Watch "XSLT and HTML" New topic


Arsalan Lodhi

Joined: Jul 05, 2001
Posts: 4
Hi all
how can I change color of rows dynamically because my rows are printed within xslt template match and If i hardcode the color then how can I change the color of a next row ?
any idea
Mapraputa Is
Leverager of our synergies

Joined: Aug 26, 2000
Posts: 10065
If you need to alternate between two colors, you can use this idiom:
<xsl:when test='position() mod 2 = 0'>
<xsl:attribute name='BGCOLOR'>white</xsl:attribute>
<xsl:attribute name='BGCOLOR'>gray</xsl:attribute>
<td> <!-- stuff for columns --> </td>
(shamelessly stolen from: Khun Yee Fung. "XSLT: Working with XML and HTML")
If it is not what you want, then you should tell us more about your requirements - what exactly means "change color of rows dynamically"?
[This message has been edited by Mapraputa Is (edited July 08, 2001).]

Uncontrolled vocabularies
"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet
I agree. Here's the link:
subject: XSLT and HTML
Similar Threads
jTable setBackground Color of particular Row
Quetion about how to change the color of a row in a JTable
cahnging color of Divider
format the html:erroes
How to make JComboBox flash (red color)?