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

Re: two column table with alternating row colors using

Subject: Re: two column table with alternating row colors using xsl xml and css
From: nicholse@xxxxxxxxxxxxxxxx
Date: Thu, 7 Aug 2003 07:29:45 -0700 (PDT)
alternating row style
> Hi.
>
> try this:

snip
>         <style>
>          <!-- this is just an example, you can change this to whatever you
> like -->
>          .r0 { background-color: silver; color: black; }
>          .r1 { color: gray; }
>         </style>

snip
>     <tr class="r{position() mod 2}">
>       <td class="r{position() mod 2}">

Yes! this works well.

Also, maybe hard to understand/explain. I want two colums. In both columns
are companies starting col 1 top left to bottom right col 2 listed in
alpebetical order. I do not understand why this would not work. Processor
complains about me trying to put the </tr><tr> between two <td>'s of an
even and odd.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fmp="http://www.filemaker.com/fmpdsoresult"
exclude-result-prefixes="fmp">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" />
<xsl:template match="fmp:FMPDSORESULT">
<HTML>
<HEAD>
<TITLE/>
<STYLE>
<!-- this is just an example, you can change this to whatever you like -->
.r0 { background-color: silver; color: black; }
.r1 { color: gray; }
</STYLE>
</HEAD>
<BODY>
<TABLE>
<TR>
<xsl:apply-templates select="fmp:ROW"/>
</TR>
</TABLE>
</xsl:template>
<xsl:template match="fmp:ROW">
<xsl:for-each select="fmp:ROW">
<xsl:sort select="fmp:Co" />
<TD class="r{position() mod 2}">
<xsl:value-of select="fmp:Co"/>
</TD>
<xsl:if test="parent::node()[(position() mod 2) = 0]">
</TR><TR>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

Thanks for both of your responses!
Eric

 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.