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

RE: choose/otherwise not doing anything?

Subject: RE: choose/otherwise not doing anything?
From: "Maesen, Edward" <emaesen@xxxxxxxx>
Date: Tue, 15 Oct 2002 12:16:10 -0700
html choose
If any of the tests is true, for instance <xsl:when test="text()='1'">, then
the output is <xsl:value-of select='positive'/>
which is an empty node.
Look at the quotes. Be sure to use appropriate quotes when outputting a
string:
Try <xsl:value-of select="'positive'"/>. All the value-of statements (except
in the otherwise) lack the double quotes.

Edward


> -----Original Message-----
> From: Richard Rowell [mailto:richard@xxxxxxxxxxxxxxxxx]
> Sent: Tuesday, October 15, 2002 12:06 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  choose/otherwise not doing anything?
> 
> 
> I'm sure I'm doing something really stupid, but I cant figure out for
> the life of me why the following template always outputs and empty
> element.  The choose has an otherwise and I would expect that to be
> output (if nothing else).  No matter what I put as the input 
> it produces
> an empty element as an output.  IE:
> 
> (input)
>    <medical_assessment>
>     <tb_test_positive>1</tb_test_positive>
>     <tb_test_positive>true</tb_test_positive>
>     <hiv_test_positive>false</hiv_test_positive>
>     <hiv_test_positive>0</hiv_test_positive>
>    ...
>    </medical_assessment>
> 
> produces:
> <medical_assessment>
> <tb_test_positive/>
> <tb_test_positive/>
> <hiv_test_positive/>
> <hiv_test_positive/>
> ...
> </medical_assessment>
> 
> I would expect to (at least) get "otherwise". My template follows:
> 
>   <xsl:template match="medical_assessment/tb_test_positive |
> medical_assessment/hiv_test_positive">
>    <xsl:element name="{name()}">
>     <xsl:choose>
>      <xsl:when test="text()='true'">
>       <xsl:value-of select='positive'/>
>      </xsl:when>
>      <xsl:when test="text()='1'">
>       <xsl:value-of select='positive'/>
>      </xsl:when>
>      <xsl:when test="text()='false'">
>       <xsl:value-of select='negative'/>
>      </xsl:when>
>      <xsl:when test="text()='0'">
>       <xsl:value-of select='negative'/>
>      </xsl:when>
>      <xsl:otherwise>
>       <xsl:value-of select="'otherwise'"/>
>      </xsl:otherwise>
>     </xsl:choose>
>    </xsl:element>
>   </xsl:template>
> 
> 
> 
> 
> 
>  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.