Subject: RE: [xsl] how do you redefine a variable From: "Michael Kay" <mhkay@xxxxxxxxxxxx> Date: Wed, 28 Feb 2001 03:12:22 -0000 |
Daniel, can I suggest you do some reading? I know there's a steep learning curve for XSLT, but there are plenty of tutorials, books, FAQs etc on which you will find answers to this common question. Sending four messages a day to a busy list is an inefficient way of organizing your learning. To find out whether position() is odd or even, test the value of position() mod 2. Mike Kay > -----Original Message----- > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of > Daniel Newman > Sent: 27 February 2001 16:30 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: [xsl] 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] how do you redefine a var, Jeni Tennison | Thread | RE: [xsl] how do you redefine a var, Tim Watts |
[xsl] Xalan 2.0 compatibility probl, Kumar Shailendra | Date | RE: [xsl] RE:"*NEVER* use for-each", Michael Kay |
Month |