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

RE: <xsl:choose> not working -- always results with <x

Subject: RE: <xsl:choose> not working -- always results with <xsl:o therwise>?
From: "Kathy Burke" <Kathy_Burke@xxxxxxxxx>
Date: Mon, 8 Sep 2003 14:45:44 -0400
choose not working
thanks, Tom, works fine now.

kathy

-----Original Message-----
From: Passin, Tom [mailto:tpassin@xxxxxxxxxxxx]
Sent: Monday, September 08, 2003 2:24 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  <xsl:choose> not working -- always results with <xsl:
otherwise>?


[Kathy Burke]

> Hi, I'm trying to use the following choose statement, but 
> when I change my
> xml text to test for both conditions, the results of 
> <xsl:otherwise> always
> show, never the first <choose> which tests (I thought) to see 
> if the text
> node of <measure> is empty. If <measure> is an empty element, 
> I would like
> to give the user an input box, otherwise, just show the data already
> entered.  Any help appreciated.  Thanks.
> 
> The xml is simply either <measure name="firstpass">20 mm</measure> or
> <measure name="firstpass/>.
> 
> <xsl:template match="measure">
>    <xsl:choose>
>       <xsl:when test="normalize-space(.)">

You probably want 

 not(normalize-space(.)
^^^

>           <input type="text" name="{@name}" value="{.}"/>
>       </xsl:when>
>       <xsl:otherwise>
>            Entered: <value-of select="."/>

You meant to write 

<xsl:value-of select="."/>
 ^^^
>       </xsl:otherwise>
>    </xsl:choose>
> </xsl:template>
> 

With these corrections, it does what you want.

Cheers,

Tom P

 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

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.