This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
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.
The WG resolved to clarify that the equivalence applies only in the case where $node matches the type signature.