This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
Having started to look at optimization of queries, I believe this query can be reduced to "true" avoiding the expected error. Since (/) introduces a "treat as document", the static type of the argument to fn:root can be deduced as empty-sequence, because we know that the parent of a document node is empty-sequence. fn:root therefore returns empty-sequence, then empty() returns true. I believe this to be similar to the case pointed out by Mike Kay in bug report 4277 (in which static type analysis means that a cast which would fail need not be evaluated). (:*******************************************************:) (: Test: K2-Axes-32 :) (: Written by: Frans Englich :) (: Date: 2007-01-22T21:16:10+01:00 :) (: Purpose: Apply axis '..' to the return value of fn:root(). :) (:*******************************************************:) declare variable $myVar := <e/>; empty(fn:root($myVar/(/)/..))
You've raised an interesting issue, Tim. The WGs discussed this at our June 5 meeting and we agreed that if static analysis can be used to determine the result of a query, then dynamic evaluation need not occur.
And XQTS_current.zip has been updated in CVS to reflect that, hopefully. K2-Axes-32 now has the baselines XPST0005, XPDY0002, and "true".
Thanks.