[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Problem in making choices using <xsl:choose>

Subject: Problem in making choices using <xsl:choose>
From: "Sreekanth Pallavoor" <sreekanth@xxxxxxxxx>
Date: Thu, 31 May 2001 19:37:26 -0700
pallavoor
Hi,

I am new to XSLT. I am writing one XSLT program, where I need to print
different output depending upon different conditions. But the code which
checks for different conditions, doesn't seem to be working properly.
The relevant part of code is given below. Here I have got a variable
"state" getting set to some state code which comes from some external
source. If it's value is AZ, I want to print "Arizona" and if it's value
is anything else then I want to print "Other". The result I am getting
is, it always prints "Arizona" even if $state is set to something other
than "AZ". (To double-check, I am printing the $state value also in the
output. Even if it is CA, the output I still get is "CA Arizona" and not
"CA Other").

Can someone tell me what could be the reason.

Thanks.
-- Sreekanth

<xsl:template match="headline">
  <xsl:choose>
    <xsl:when test="contains($state,'AZ')">
      <font face="{$headline-font}"
size="{$headline-size}"><xsl:value-of select="$state"/> Arizona </font>
    </xsl:when>
    <xsl:otherwise>
      <font face="{$headline-font}"
size="{$headline-size}"><xsl:value-of select="$state"/> Other </font>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.