This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 17026 - [FO30] has-children() equivalence in failure cases
Summary: [FO30] has-children() equivalence in failure cases
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Functions and Operators 3.0 (show other bugs)
Version: Last Call drafts
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-10 11:14 UTC by Michael Kay
Modified: 2012-05-15 17:35 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2012-05-10 11:14:03 UTC
The specification for has-children() states:

The result of the function call fn:has-children($node) is defined to be the same as the result of the expression fn:exists($node/child::node()).

However, this is only true in success cases. Examples of differences:

(a) if $node is not a node, the error code is XPTY0004 rather than XPTY0020

(b) if $node is a sequence of two nodes, the result is a type error rather than true or false.

So the implication that a call on has-children can be statically rewritten in this form is incorrect.
Comment 1 Michael Kay 2012-05-15 16:08:38 UTC
The WG resolved to clarify that the equivalence applies only in the case where $node matches the type signature.