Forwarded for archival purposes.

---------- Forwarded message ----------
To: "Chappell, Alan R" <[EMAIL PROTECTED]>
From: bob mcwhirter <[EMAIL PROTECTED]>
Date: Wed, 10 Oct 2001 22:58:46 -0400 (EDT)
Subject: RE: [Jaxen] booleanValueOf issue

On Wed, 10 Oct 2001, Chappell, Alan R wrote:

> >From the XSLT spec:
> "The xsl:if element has a test attribute, which specifies an expression. ...
> The expression is evaluated and the resulting object is converted to a
> boolean as if by a call to the boolean function."
> 
> The test attribute is an XPath expression, of course. So, 
> 
> <xsl:if test="//testElement[2] = 3"> 
>   <enclosed xslt statements>
> </xsl:if>
> 
> should do the enclosed statements if the test evaluates to true (the second
> testElement has a value of 3).
> 
> Since jaSelectNodes is already giving the Boolean value, I hate to convert
> to a String, and then back to a boolean.

Ahh...

So, you want something with the semantics of...

        if selectNodes() results in a 1-item list,
        and the 1 item is Boolean, then return that
        boolean's value.

        if selectNodes() results in a multi-item list,
        perform normal boolean() function conversion.

I can easily add some flavor of Helper class to perform
that analysis, if you like, but it's kinda non-standard.

Though, if there's votes in favor, I could be convinced to
add that functionality directly to BaseXPath.

        -bob



_______________________________________________
Jaxen-interest mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jaxen-interest

Reply via email to