On Fri, 17 Jun 2011, G. Ken Holman wrote:

> At 2011-06-17 17:58 +0000, Will Thompson wrote:
> xs:boolean does a cast of the argument.  The first bullet of the
> documentation cites what is returned when the argument is an empty set:
>
>   http://www.w3.org/TR/2007/REC-xpath-functions-20070123/#func-boolean

So per specs, xs:boolean(()) should return "false" as a boolean.

However, that's not the behavior in MarkLogic. Version "0.9-ml" throws 
an error, "Invalid cast". Versions 1.0 and 1.0-ml return empty sequence. 
(For what it's worth, Saxon 9.3 returns empty sequence as well.)

In most cases, having a return value of empty sequence versus boolean 
false probably won't affect expected results, but there are differences. 
For example, Marklogic evaluates

    empty(false())         ==>  false
    empty(xs:boolean(()))  ==>  true

whereas the XPath specs suggest both should return "false"?

DS

-- 
David Sewell, Editorial and Technical Manager
ROTUNDA, The University of Virginia Press
PO Box 400314, Charlottesville, VA 22904-4314 USA
Email: [email protected]   Tel: +1 434 924 9973
Web: http://rotunda.upress.virginia.edu/
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to