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

new poster / conditionals in for-each

Subject: new poster / conditionals in for-each
From: "Chris Reeves" <noverant@xxxxxxxxxxx>
Date: Wed, 19 Jan 2000 11:14:33 EST
chris reeves
Im a new poster as well as a new xml/xsl developer so take it easy on me. I've been using xsl all of four weeks and to this point I've been able to get it to do what i need - but now I've come across a problem. The root of the problem may very well be that I am treating xsl as a cgi application which I probably shouldn't be doing, but it makes sense to me that I would be able to do the following.

I want to do conditional processing based on the position of an element within a xsl:for-each? That is, if this is the first iteration of the xsl:for-each, i want to do x, and if its the second, i want to do y.
Specifically, I am trying to alternate the bgcolor of a row for each iteration of the for-each loop.
My xml looks like this:

	<location>some location</location>
	<location>some location</location>
	<location>some location</location>
	<location>some location</location>

My output is in an html table and i want to do something similar to this:

<xsl:for-each select="session">
	<if current loop is divisible by 2>
		<tr bgcolor="ffffff">
	<if it isn't>
		<tr bgcolor="e0e0e0">
	. . .

Thanks for any help. Also, any suggestions as far as good literature would be much appreciated. I have XML Design and Implementation by Paul Spencer, and it may be a good book, but my experience with other languages is that there is usually a definitive developers 'bible' which stands heads above the rest. Is there such a reference for web specific xml/xsl?

thanks for any help,
Get Your Private, Free Email at http://www.hotmail.com

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

Current Thread


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.
First Name
Last Name
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.