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

Re: Every other row with a different twist

Subject: Re: Every other row with a different twist
From: Arni J Rognvaldsson <arni.rognvaldsson@xxxxxxxxxx>
Date: Wed, 17 Jan 2001 10:24:37 -0500
javascript every other row
Thank you for your help, David's suggestion is implemented and working.
I changed <tr class="..."> to <tr id="..."> since class was already used and that way I can color trs of different classes. I like the shortcut of appending position() mod 2 to the class/id name, much shorter and clearer than using an xsl:if.


Thanks again, really appreciate it.

Arni

At 11:30 PM 1/16/2001 +0000, David Carlisle wrote:



Your three fields address/name employer/name employer/tel
appear to be in document order (if they are in the document)
does your DTD enforce that?

If so you can get away with


<xsl:template match="person"> <table> <xsl:apply-templates select=" address/name | employer/name | employer/tel"/> </table> </xsl:template>

<xsl:template match="address/name">
          <tr class="rowstyle{position() mod 2}">
             <td>Person's home city:</td>
             <td><xsl:value-of select="address/name"/></td>
          </tr>
</xsl:template>

etc

plus suitable css for .rowstyle0 and .rowstyle1

If you can't be sure of the order, you can do two passes, first
generating the output tree into a node set  and using a node-set
extension function provided by most xsl systems to add the attributes
later.

Alternatively of course you could do the colouring in the client with a
bit of javascript that coloured each row depending on its position
(but its too late at night for me to think javascript now)

David

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.