[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Trying to learn XSL
I'm trying to play around with some XSL. Someone else wrote this and I'm trying to figure out how to change it to my liking. What I want to do is for every other table cell after the table header have the colors of the table cell change every other cell. Here's what I have so far: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" indent="yes"/> <xsl:strip-space elements="*"/> <xsl:template match="/"> <html> <head><title>Incidents Currently Logged at Handango.com</title></head> <body> <xsl:apply-templates/> </body> </html> </xsl:template> <xsl:template match="/*"> <table border='2'> <xsl:for-each select="*[position() = 1]/*"> <th bgcolor='GRAY'> <xsl:value-of select="local-name()"/> </th> </xsl:for-each> <xsl:apply-templates/> </table> </xsl:template> <xsl:template match="/*/*"> <tr> <xsl:apply-templates/> </tr> </xsl:template> <xsl:template match="/*/*/*"> <td bgcolor="slateblue"> <font color="wheat"> </font> </td> </xsl:template> </xsl:stylesheet> I'm wondering if I need a function to do this, something like: <xsl:choose> <xsl:when expr="[position() mod 2] =1"> some html </xsl:when> <xsl:when expr="[position() mod 2] =0"> some html </xsl:when> </xsl:choose> Am I on the right track? Or have I derailed? Any help is appreciated. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|