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 4392 - [FS] Typing issues with //
Summary: [FS] Typing issues with //
Status: CLOSED WONTFIX
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Formal Semantics 1.0 (show other bugs)
Version: Recommendation
Hardware: All Windows XP
: P2 normal
Target Milestone: ---
Assignee: Michael Dyck
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-14 15:35 UTC by Nick Jones
Modified: 2007-05-15 15:53 UTC (History)
0 users

See Also:


Attachments

Description Nick Jones 2007-03-14 15:35:27 UTC
This is along a similar vein to #4273 and #3818, but has some added issues with the typing of fn:root hence I am reporting as a separate bug

We are using the expression "//@status = 'failed'" where the context is an untyped document "document (element (*,xs:unTyped))"

This fails to type check as @status is found to be anyAtomicType.

The reason this happens is "//" is normalized to "fn:root(self::node()) treat as document-node)/descendant-or-self::node()/"


As mentioned in #3818 the treat as document-node throw away typing information (namely that the document is untyped) so all data in return nodes will be xs:anyType.

With our suggested static typing extensions in comment #16 we run into the problem that fn:root returns node()? which is not a subtype of document-node (which is presumably why the treat as expression was used in the first place).

Therefore for the "//" expression to be able to work in a static type checking environment with untyped documents I think there need to be explicit static typing rules for fn:root which return the appropriate type rather than by use of treat as in the path expression.
Comment 1 Michael Kay 2007-03-20 17:01:05 UTC
I can't comment very intelligently on static typing issues, but just one observation: the reason for the "treat as document-node()" in the expansion of "/" is to ensure that "/" is an error when the context item is a node in a tree whose root is not a document node. In such a tree, root() will select an element node (say), but "/" throws an error.

Michael Kay
Comment 2 Jerome Simeon 2007-05-08 16:08:48 UTC
This is a known problem with the semantics of path expressions starting with '/' and '//'. The main problem here is the use of the fn:root() function which goes up the document, and for which we cannot easily do static typing.

I think the way static typine works here is not really a bug on XQuery 1.0, but possibly may be a request for XQuery 1.1 feature.

- Jerome
Comment 3 Jerome Simeon 2007-05-15 15:51:51 UTC
Nick,
The working groups have reviewed your comment. This issue has been considered in the past, and the group feels that we cannot provide better static typing for '/' and '//' right now because of the use of the fn:root() function. We will consider this as a possible improvement for the next version.
Best regards,
- Jerome Simeon, On behalf of the XSLT and XML Query working groups