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

RE: boolean values

Subject: RE: boolean values
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Thu, 28 Aug 2003 09:21:07 +0100
xsl other
> 
> However, due to business needs, I have to expand my variable. 
>  I have since code it in this manner:
> 
>    <xsl:variable name="hasContracts">
>    		<xsl:choose>
>    			<xsl:when test="$branding = 
> 'ABC'"><xsl:value-of 
> select="count(/Output/Contracts/Contract[substring(ContractId,
> 1,1)='Q']) &#62; 0"/>			</xsl:when>
>    			<xsl:otherwise><xsl:value-of 
> select="boolean(/Output/Contracts/Contract)"/></xsl:other
> wise>  		
>    		</xsl:choose>    
>    </xsl:variable> 
> 
> And now it is no longer a boolean value, perhaps because true 
> or false is a child of the xsl:variable element?
> 
> Is there a way to put the value of your variable in a 
> xsl:choose and retain a true boolean value?

Not directly, in XSLT 1.0 (In XSLT 2.0, you can use xsl:sequence).

But you can create a variable whose value is an RTF (as above), and then
create a second variable that converts it to a boolean:

<xsl:variable name="hasContracts-boolean" select="$hasContracts =
'true'"/>

Michael Kay


 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.