xsl-list
[Top] [All Lists]

RE: Re: XPath 2.0: Problems with the two boolean constants true and false

2003-10-09 04:38:01

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



<Prev in Thread] Current Thread [Next in Thread>