You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Chappuis J.-Vincent" <vi...@idbsoft.ch> on 2000/11/22 17:54:38 UTC
change xsl variable value
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 ?
Thanks
Re: change xsl variable value
Posted by "Chappuis J.-Vincent" <vi...@idbsoft.ch>.
Thanks it run now...
Sorry for my "no respect of convention" but my xsl works when I run it with
the XML-XSL editor I use (Excelon Stylus).
So I belived that it was (maybe) a problem from Cocoon.
----- Original Message -----
From: "Corey O'Donovan" <od...@feersumendjinns.com>
To: <co...@xml.apache.org>
Sent: Wednesday, November 22, 2000 6:13 PM
Subject: Re: change xsl variable value
> Hi,
>
> This is off-topic for the cocoon list.
> Have a look at http://xml.apache.org/cocoon/mail-lists.html
> and http://xml.apache.org/cocoon/faqs.html#faq-xsllists
> for xsl resources.
>
> That been said try:
>
> <xsl:for-each select="ResultListScreen/FACompany">
> <xsl:choose>
> <xsl:when test="position() mod 2 = 0">
> <tr>
> <xsl:attribute name="bgcolor">#cccccc</xsl:attribute>
> </tr>
> </xsl:when>
> <xsl:otherwise>
> <tr>
> <xsl:attribute name="bgcolor">#eeeeee</</xsl:attribute>
> </tr>
> </xsl:otherwise>
> </xsl:choose>
> </xsl:for-each>
>
> Corey O'Donovan
>
> ----- Original Message -----
> From: Chappuis J.-Vincent
> To: cocoon-users@xml.apache.org
> Sent: Wednesday, November 22, 2000 4:54 PM
> Subject: change xsl variable value
>
>
> 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 ?
>
> Thanks
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
Re: change xsl variable value
Posted by Corey O'Donovan <od...@feersumendjinns.com>.
Hi,
This is off-topic for the cocoon list.
Have a look at http://xml.apache.org/cocoon/mail-lists.html
and http://xml.apache.org/cocoon/faqs.html#faq-xsllists
for xsl resources.
That been said try:
<xsl:for-each select="ResultListScreen/FACompany">
<xsl:choose>
<xsl:when test="position() mod 2 = 0">
<tr>
<xsl:attribute name="bgcolor">#cccccc</xsl:attribute>
</tr>
</xsl:when>
<xsl:otherwise>
<tr>
<xsl:attribute name="bgcolor">#eeeeee</</xsl:attribute>
</tr>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
Corey O'Donovan
----- Original Message -----
From: Chappuis J.-Vincent
To: cocoon-users@xml.apache.org
Sent: Wednesday, November 22, 2000 4:54 PM
Subject: change xsl variable value
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 ?
Thanks
Re: change xsl variable value
Posted by Ulrich Mayring <ul...@denic.de>.
> "Chappuis J.-Vincent" wrote:
>
> Hi all, I need help about changing an xsl variable value
1. This is off-topic here.
2. It cannot be done.
Ulrich
--
Ulrich Mayring
DENIC eG, Systementwicklung
Re: change xsl variable value
Posted by "Piroumian, Konstantin" <KP...@flagship.ru>.
Hi!
There is another way of changing the variable's value: it requires recursive
programming and named templates.
It is not a real value assigning.
This can be useful in some cases.
In your case it's better, of course, to use a predicate (like position() mod
2) to achieve the result you need.
Regards,
Konstantin Piroumian
> Thanks all
> ----- Original Message -----
> From: "Mariusz Nowostawski" <ma...@marni.otago.ac.nz>
> To: <co...@xml.apache.org>
> Sent: Wednesday, November 22, 2000 9:58 PM
> Subject: Re: change xsl variable value
>
>
> > 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 ?
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: cocoon-users-help@xml.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
Re: change xsl variable value
Posted by "Chappuis J.-Vincent" <vi...@idbsoft.ch>.
Thanks all
----- Original Message -----
From: "Mariusz Nowostawski" <ma...@marni.otago.ac.nz>
To: <co...@xml.apache.org>
Sent: Wednesday, November 22, 2000 9:58 PM
Subject: Re: change xsl variable value
> 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 ?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
Re: change xsl variable value
Posted by Mariusz Nowostawski <ma...@marni.otago.ac.nz>.
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 ?
Re: change xsl variable value
Posted by Matthew Cordes <mc...@maine.edu>.
Variables in XSLT are static, you cannot change them.
-matt
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 ?
>
> Thanks
>
>
>
>