[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Or with xsl:when to check for multiple values


Subject: Re: [xsl] Or with xsl:when to check for multiple values
From: "M. David Peterson" <m.david@xxxxxxxxxx>
Date: Fri, 31 Oct 2003 15:30:20 -0700

Exclude the double quotes (except for the first and last one) and you should
be ok...

<xsl:when test="$var = 'val1' or $var = 'val2' or $var = 'val3'">
    do something...
</xsl:when>

Best of luck...

M.

----- Original Message ----- 
From: "Dipesh Khakhkhar" <dkhakhkh@xxxxxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Friday, October 31, 2003 2:49 PM
Subject: [xsl] Or with xsl:when to check for multiple values


> Hi,
>
> I want to check a value against few strings.
> Can i do something like
>
> <xsl:when test="$var = 'val1'" or "$var = 'val2'" or "$var = 'val3'">
>   some action
> </xsl:when>
>
> Or to achieve this i have to write like
>  <xsl:when test="$var = 'val1'" >
>        Some action
>   <xsl:when>
>  <xsl:when test="$var = 'val2'">
>      Some action
>  </xsl:when>
>
> Since the action code is same I thought if something can be done writing
OR
> expression. Is there some other way to achieve it more effectively.
>
> I hope i am clear in explaining my problem.
> Thanks in the anticipation that I will get some good hints to solve this.
>
> Regards,
> Dipesh
>
>
>  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