Subject: RE: [xsl] Background color in table From: "Bryan Archer" <barcher@xxxxxx> Date: Tue, 27 May 2003 13:51:18 +0100 |
Use the position() function. <xsl:template match="/"> <table> <xsl:for-each select="root/pack/service" > <tr> <td bgcolor="#FFFFFF"> <xsl:if test="position() mod 2 = 1"> <xsl:attribute name="bgcolor">#000000</xsl:attribute> </xsl:if> <xsl:value-of select="name" /> </td> </tr> </xsl:for-each> </table> </xsl:template> Bryan -----Original Message----- From: Andreas Byström [mailto:andreas.bystrom@xxxxxxxxxxxx] Sent: 27 May 2003 13:33 To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: [xsl] Background color in table Hi all! I'm about to make web page that should have a table of names in it. I would like to have different background color on each other ro in the table, example: black white black white... I have trouble getting this to work with the XSL. This is an example on the xml I have to work with <pack> <service> <name>name1</name> </service> <service> <name>name2</name> </service> </pack> <pack> <service> <name>name3</name> </service> <service> <name>name4</name> </service> </pack> I want to list all services names. I managed to solve it when I only had one <pack> tag, but now I can have several pack-tags. Does someone know how to get a nice table from this data? Regards, Andreas XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list Visit our website at http://www.rm.com This message is confidential. You should not copy it or disclose its contents to anyone. You may use and apply the information only for the intended purpose. Internet communications are not secure and therefore RM does not accept legal responsibility for the contents of this message. Any views or opinions presented are only those of the author and not those of RM. If this email has come to you in error please delete it and any attachments. Please note that RM may intercept incoming and outgoing e-mail communications. This email has been scanned for viruses by Trend ScanMail. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Background color in table, David Carlisle | Thread | RE: [xsl] Background color in table, Andreas Byström |
Re: [xsl] Background color in table, David Carlisle | Date | RE: [xsl] Background color in table, Jarno . Elovirta |
Month |