> I'm trying to implement something very much like an xsl if statement. To > evaluate the test attribute I've been trying to use the > BaseXPath.booleanValueOf method. Tracing it through, this works great up > until the very end. > > BaseXPath.booleanValueOf() calls JaXPath.jaBooleanValueOf(), which correctly > evaluates the test attribute and gets a list of Boolean.TRUE's or > Boolean.FALSE's. However, it then calls BooleanFunction.evaluate() which > says, there's something on the list, return true.
>From the XPath spec, it seems that a non-empty list is *true*, regardless of the contents. Strange, but true. If you're only concerned about the first item on the list, doing a conversion through string() might help. Effectively: boolean( string( myList ) ) or the similar fooValueOf() call chain. -bob 4.3 Boolean Functions Function: boolean boolean(object) The boolean function converts its argument to a boolean as follows: * a number is true if and only if it is neither positive or negative zero nor NaN * a node-set is true if and only if it is non-empty * a string is true if and only if its length is non-zero * an object of a type other than the four basic types is converted to a boolean in a way that is dependent on that type _______________________________________________ Jaxen-interest mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jaxen-interest