You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Gergely Imre <gi...@nextra.ro> on 2000/09/25 20:11:23 UTC
Re: If...then
How can I check an element's value in an <xsl:choose>...<xsl:when>
clause?
I.e. I have
<unit>10<unit>
and I want to:
<xsl:choose>
<xsl:when test="unit" value="10"> <--- this obviously doesn't work
The value is 10!
<xsl:when test="unit" value="100">
The value is 100!
</xsl:choose>
--
GImre
-> ICQ# 86297366
Re: If...then
Posted by Berin Loritsch <bl...@infoplanning.com>.
----- Original Message -----
From: "Gergely Imre" <gi...@nextra.ro>
To: <co...@xml.apache.org>
Sent: Monday, September 25, 2000 2:11 PM
Subject: Re: If...then
> How can I check an element's value in an <xsl:choose>...<xsl:when>
> clause?
>
> I.e. I have
> <unit>10<unit>
>
> and I want to:
>
> <xsl:choose>
> <xsl:when test="unit" value="10"> <--- this obviously doesn't work
> The value is 10!
> <xsl:when test="unit" value="100">
> The value is 100!
> </xsl:choose>
try this instead:
<xsl:choose>
<xsl:when test="{test}=10">
The value is 10!
</xsl:when>
<xsl:otherwise>
I am full of it.
</xsl:otherwise>
</xsl:choose>
It took me a while to figure out that if you want to access the value
of nodes or attributes inside quotes in XSLT that you had to surround
the name with curly braces. If you wanted to find the value of an
attribute use this structure:
<xsl:choose>
<xsl:when test="{@test}=10">
The value is 10!
</xsl:when>
<xsl:otherwise>
I am full of it.
</xsl:otherwise>
</xsl:choose>
Hope this helps!
---------------------------------------------------------
If you lust for Ham and Eggs, you have
committed breakfast in your heart
already. -- C. S. Lewis
Re: If...then
Posted by Gergely Imre <gi...@nextra.ro>.
I got it, don't bother :-)))
Gergely Imre wrote:
>
> How can I check an element's value in an <xsl:choose>...<xsl:when>
> clause?
>
> I.e. I have
> <unit>10<unit>
>
> and I want to:
>
> <xsl:choose>
> <xsl:when test="unit" value="10"> <--- this obviously doesn't work
> The value is 10!
> <xsl:when test="unit" value="100">
> The value is 100!
> </xsl:choose>
>
> --
> GImre
> -> ICQ# 86297366
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
--
GImre
-> ICQ# 86297366