[Bug 4392] Typing issues with //

http://www.w3.org/Bugs/Public/show_bug.cgi?id=4392

           Summary: Typing issues with //
           Product: XPath / XQuery / XSLT
           Version: Recommendation
          Platform: All
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Functions and Operators
        AssignedTo: ashok.malhotra@oracle.com
        ReportedBy: nick@cbcl.co.uk
         QAContact: public-qt-comments@w3.org


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.

Received on Wednesday, 14 March 2007 15:37:05 UTC