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

RE: Trying to learn XSL

Subject: RE: Trying to learn XSL
From: "Respess, Christe" <crespess@xxxxxxxxxx>
Date: Mon, 28 Feb 2000 12:53:17 -0800
tucker respess
Hi Tucker:

I came up with the following code last week when attempting to do the
same thing you are.  It's not XSLT - Just plain ol' XSL.  I am a novice
myself, so there's probably a more elegant solution, especially if you
can use XSLT (I can't).

The basic structure of my table body elements is:

<TGROUP>
<TBODY>
<ROW>
<ENTRY></ENTRY>
<ENTRY></ENTRY>
</ROW>
<ROW>
<ENTRY></ENTRY>
<ENTRY></ENTRY>
</ROW>
</TBODY>
</TGROUP>

This segment of code is from within the table template, after the table
header has been dealt with:

	<xsl:for-each select="TGROUP/TBODY//ROW">
		<xsl:choose>
		<xsl:when expr="odd(this)">
		<TR CLASS="clsOddRow">
			<xsl:for-each select="ENTRY">
				<TD>
				<xsl:value-of select="." />
				</TD>
			</xsl:for-each>
		</TR>
		</xsl:when>
		<xsl:otherwise>
			<TR CLASS="clsEvenRow">
				<xsl:for-each select="ENTRY">
					<TD>
					<xsl:value-of select="." />
					</TD>
				</xsl:for-each>
			</TR>
		</xsl:otherwise>
		</xsl:choose>
	</xsl:for-each>

Here's the odd function used in the code above:

	<xsl:script><![CDATA[
	function odd(e) {
	    return absoluteChildNumber(e)%2 != 0;
	}
	]]></xsl:script>

The actual shading/coloring of the rows is done in a separate CSS file,
as, for our project, we wish to keep the specific formatting details out
the XSL.  Here's the segment of the CSS file that deals with clsOddRow:

	TR.clsOddRow
	{
	    BACKGROUND-COLOR: gray;
	}

Hope this helps a little.  You'd have to modify to deal with cells
rather than rows as is done here.  I welcome anyone's suggestions for
improvement (given my limitation to IE5 XSL only).

Christe

------------------------------

Date: Thu, 24 Feb 2000 18:04:39 -0600
From: Tucker Williams <tucker@xxxxxxxxxxxx>
Subject: 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.

<SNIP>


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


Current Thread
  • XSDL Presentation, (continued)
      • Earl Bingham - Fri, 25 Feb 2000 10:34:51 -0800
        • anoop - Mon, 28 Feb 2000 07:32:40 +0530
        • Navid A. Yar - Mon, 28 Feb 2000 22:13:01 -0600
        • taywt - Tue, 29 Feb 2000 19:07:33 +0800
    • Respess, Christe - Mon, 28 Feb 2000 12:53:17 -0800 <=

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.