W3C home > Mailing lists > Public > public-qt-comments@w3.org > July 2003

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

From: Kay, Michael <Michael.Kay@softwareag.com>
Date: Tue, 1 Jul 2003 19:50:46 +0200
Message-ID: <DFF2AC9E3583D511A21F0008C7E62106073DCF9A@daemsg02.software-ag.de>
To: Michael Rys <mrys@microsoft.com>, public-qt-comments@w3.org

> 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.

I agree with this comment, IIRC the XSL WG as a whole wanted this change. Of
course it adds weight to the requirement for the ancestor axis.
> Also note that in XPath 1.0, fn:root() always gave a document node.

XPath 1.0 did not have an fn:root() function, but it's true that "/" always
gave you a root node, which is what XPath 1.0 called the document node.

Michael Kay

> NOTE: This would give at least a return type document (see LC1-088).
Received on Tuesday, 1 July 2003 13:51:05 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:56:48 UTC