cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mariusz Nowostawski <mari...@marni.otago.ac.nz>
Subject Re: change xsl variable value
Date Wed, 22 Nov 2000 20:58:26 GMT
Hi, 

Chappuis J.-Vincent,

for your problem simply use test like: position() mod 2 = 0 
(or mod 4, sometimes mod 2 does not work ;) and you should get different
table cells with different colors. I use it for simple cases like yours
with full success (with mod 4).

Matthew Cordes wrote:

> Variables in XSLT are static, you cannot change them.

You mean "final"?  ;o)
Is there any way to keep a local/global "state" when doing XSLT
processing? Or the only possible solution for keeping a state is to pass a
parameter to a parametrized templates?

Mariusz


 
> On Wed, Nov 22, 2000 at 05:54:38PM +0100, Chappuis J.-Vincent wrote:
> > Hi all, I need help about changing an xsl variable value
> > 
> > Problem : 
> > I would like to make a list screen. There are a lot of data and I would to put one
line in a color and the other in an other color and so on...
> > 
> > I make like that :
> > 
> >   [...]
> > <xsl:variable name="colored" select="0"/>
> > <xsl:for-each select="ResultListScreen/FACompany">
> > <xsl:choose>
> >   <xsl:when test='$colored = "0"'>
> >     <tr bgcolor = "#EEEEFF">
> >     [...]
> >     </tr>
> >     <xsl:variable name="colored" select="1"/>
> >   </xsl:when>
> >   <xsl:otherwise>
> >     <tr>
> >     [...]
> >     </tr>
> >     <xsl:variable name="colored" select="0"/>
> >   </xsl:otherwise>
> > </xsl:choose>
> > </xsl:for-each>
> > [...]
> > 
> > but, it doesn't work --> always the same color !
> > I tried with and editor (Excelon Stylus) and It works but not with cocoon.
> > 
> > So I think that the colored variable is always at "0" and not reinitialised.
> > 
> > Any idea ?


Mime
View raw message