<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>4392</bug_id>
          
          <creation_ts>2007-03-14 15:35:27 +0000</creation_ts>
          <short_desc>[FS] Typing issues with //</short_desc>
          <delta_ts>2007-05-15 15:53:46 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XPath / XQuery / XSLT</product>
          <component>Formal Semantics 1.0</component>
          <version>Recommendation</version>
          <rep_platform>All</rep_platform>
          <op_sys>Windows XP</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Nick Jones">nick</reporter>
          <assigned_to name="Michael Dyck">jmdyck</assigned_to>
          
          
          <qa_contact name="Mailing list for public feedback on specs from XSL and XML Query WGs">public-qt-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>14420</commentid>
    <comment_count>0</comment_count>
    <who name="Nick Jones">nick</who>
    <bug_when>2007-03-14 15:35:27 +0000</bug_when>
    <thetext>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 &quot;//@status = &apos;failed&apos;&quot; where the context is an untyped document &quot;document (element (*,xs:unTyped))&quot;

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

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


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 &quot;//&quot; 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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>14488</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2007-03-20 17:01:05 +0000</bug_when>
    <thetext>I can&apos;t comment very intelligently on static typing issues, but just one observation: the reason for the &quot;treat as document-node()&quot; in the expansion of &quot;/&quot; is to ensure that &quot;/&quot; 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 &quot;/&quot; throws an error.

Michael Kay</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>15047</commentid>
    <comment_count>2</comment_count>
    <who name="Jerome Simeon">simeon</who>
    <bug_when>2007-05-08 16:08:48 +0000</bug_when>
    <thetext>This is a known problem with the semantics of path expressions starting with &apos;/&apos; and &apos;//&apos;. 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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>15089</commentid>
    <comment_count>3</comment_count>
    <who name="Jerome Simeon">simeon</who>
    <bug_when>2007-05-15 15:51:51 +0000</bug_when>
    <thetext>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 &apos;/&apos; and &apos;//&apos; 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</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>