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

RE: effecient inline multi-conditional testing

Subject: RE: effecient inline multi-conditional testing
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Wed, 21 Nov 2001 10:42:41 -0000
conditional testing
Have I misunderstood, because to me it looks as if you're trying to say

<xsl:choose>
<xsl:when test="substring-before($cast, '-')=$bvalue">true</xsl:when>
<xsl:when test="substring-after($cast, '-')=$bvalue">false</xsl:when>
<xsl:otherwise>error</xsl:otherwise>
</xsl:choose>

Mike Kay


> 
> 
> here's the task:
>   -create a template to cast an overloaded boolean value
> 
> here's the psuedo-template:
> 	<xsl:template name="cast:boolean">
> 		<xsl:param name="b-value">
> 			<!-- overloaded boolean value;  
> 				some potential values may be:
> 					1.  'true' or 'false' 
> or 't' or 'f'
> 					2.  'yes' or 'no' or 'y' or 'n'
> 					3.  '1' or '0'
> 					4.  ...
> 			  -->				
> 		</xsl:param>
> 		<xsl:param name="cast">
> 			<!-- 'casting' operator;  
> 				some potential values may be:
> 					1.  'true-false' or 't-f'
> 					2.  'yes-no' or 'y-n'
> 					3.  '1-0'
> 					4.  ...
> 			  -->
> 		</xsl:param>
> 		<xsl:if test="$operand">
> 			<xsl:if
> test="(($b-value='1')or($b-value='0')or($b-value='true')or($b-
> value='false')
> or($b-value='yes')or($b-value='no') ... )">
> 				<xsl:choose>
> 					<xsl:when
> test="('true-false'=$cast)">
> 						<!-- ... -->
> 
> 					</xsl:when>
> 					<xsl:when 
> test="('yes-no'=$cast)">
> 						<!-- ... -->
> 
> 					</xsl:when>
> 					<xsl:otherwise>
> 						<!-- ... -->
> 					</xsl:otherwise>
> 
> 				</xsl:choose>
> 			</xsl:if>
> 		</xsl:if>
> 	</xsl:template>
> 
> my question is this:
> Any ideas on a more effecient way to conduct the second 
> (xsl:if) test than
> the way I'm about to?
> 
> Maybe some stylesheet scoped param that acts like a mask and 
> then use the
> translate(...) function?  Or, ...?
> 
> If there is a FAQ on this, then I apologize ... I looked and 
> couldn't find
> one.
> 
> Thanks,
> Jeff
> 
>  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.