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

RE: Re: XPath 2.0: Problems with the two boolean const

Subject: RE: Re: XPath 2.0: Problems with the two boolean constants true and false
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Thu, 9 Oct 2003 12:38:01 +0100
RE:  Re: XPath 2.0: Problems with the two boolean const
> 
> I am referring to the situation after the bug is corrected.
> 
> Then, this template:
> 
>   <xsl:template name="And" match="test:*">
>     <xsl:param name="arg1" as="xs:boolean"/>
>     <xsl:param name="arg2"  as="xs:boolean"/>
>          <xsl:value-of 
>          select="$arg1 and $arg2"/>
>   </xsl:template>
> 
> when instantiated with:
> 
>    <xsl:apply-templates select="document('')/*/test:*[1]">
>      <xsl:with-param name="arg1" select="'false'"/>
>      <xsl:with-param name="arg2" select="'true'"/>
>    </xsl:apply-templates>
> 
> will raise an error, because the arguments are strings, but 
> the parameters of the template are of type xs:boolean.
> 
> Therefore, I am forced to remove the types for the parameters 
> of the template and do the conversion myself:
> 
>   <xsl:template name="And" match="test:*">
>     <xsl:param name="arg1"/>
>     <xsl:param name="arg2"/>
>     <xsl:value-of 
>          select="xs:boolean(xs:boolean($arg1) and 
> xs:boolean($arg2))"/>
>   </xsl:template>

Why not just call the template with boolean values?

    <xsl:apply-templates select="document('')/*/test:*[1]">
      <xsl:with-param name="arg1" select="false()"/>
      <xsl:with-param name="arg2" select="true()"/>
    </xsl:apply-templates>

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.