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

RE: how do you redefine a variable

Subject: RE: how do you redefine a variable
From: "Keith" <keith@xxxxxxxxxxxxx>
Date: Tue, 27 Feb 2001 11:37:53 -0600
xsl variable redefine
this works for alternating row colors....

<xsl:for-each select="something">
	<tr><xsl:if test="position() mod 2 = 0"><xsl:attribute
name="style">background-color: #cccccc</xsl:attribute></xsl:if>
		<td>	row data here</td>
	</tr>
</xsl:for-each>

Keith Brooks
Software Developer
Global eTelecom
Keith@xxxxxxxxxxxxxxxxxx

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Daniel Newman
Sent: Tuesday, February 27, 2001 10:30 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  how do you redefine a variable


I'm trying to colour my table rows, either one colour or another.

I thought I'd do something similar to how I do it ASP.

<xsl:variable name="rowCounter">1</xsl:variable>
<xsl:for-each select="">
  <xsl:choose>
    <xsl:when test="$rowCounter = 1">
      <xsl:variable name="bgcolor">red</xsl:variable>
      <xsl:variable name="rowCounter">0</xsl:variable>
    </xsl:when>
    <xsl:otherwise>
      <xsl:variable name="bgcolor">blue</xsl:variable>
      <xsl:variable name="rowCounter">1</xsl:variable>
    </xsl:otherwise>
  </xsl:choose>
</xsl:for-each>

BUT, it won't let me reallocate $rowCounter as it's already defined. So, how
could I do this using the wonders of XSL. I thought about getting the
position() value, and doing something with this, but it would ultimately
need to be a 0 or 1 (or 1 or 2 if that's easier). Is there an If
odd(position()), if even(position()) syntax I could use?

Thanks for now.....

Daniel.


 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.