• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

XSLT and HTML

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
arsalan
 
Leverager of our synergies
Posts: 10065
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you need to alternate between two colors, you can use this idiom:
<tr>
<xsl:choose>
<xsl:when test='position() mod 2 = 0'>
<xsl:attribute name='BGCOLOR'>white</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name='BGCOLOR'>gray</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<td> <!-- stuff for columns --> </td>
</tr>
(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).]
 
Our first order of business must be this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic