[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Background color in table

Subject: RE: Background color in table
From: Andreas Byström <andreas.bystrom@xxxxxxxxxxxx>
Date: Tue, 27 May 2003 16:04:56 +0200
andreas bystr m
Thanks, this solved this

Regards,
Andreas

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Bryan Archer
Sent: den 27 maj 2003 14:51
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  Background color in table


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:  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


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.