MS-FO-LC1-089: fn:root() should only be defined when a document node exists

Class: Technical
				
Section 14.1.9 fn:root: fn:root() should error if root node is not a
document node. Otherwise the following expression is surprising:
(<a><b/><c/></a>)[/a/c]/b

The above expression does not return the b element, since the / would
return the a element node which does not contain an a and thus the
predicate evaluates to false.

If we return an error, we avoid this issue. Users can use a let
expression to bind the constructed element. And we can decide in a later
version to give it a different semantics.

Also note that in XPath 1.0, fn:root() always gave a document node.

NOTE: This would give at least a return type document (see LC1-088).

Received on Tuesday, 1 July 2003 04:05:53 UTC