<?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>3308</bug_id>
          
          <creation_ts>2006-06-01 21:14:56 +0000</creation_ts>
          <short_desc>Which error to raise for attributes with the same node-name in a direct element constructor?</short_desc>
          <delta_ts>2006-06-06 16:59:42 +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>XQuery 1.0</component>
          <version>Candidate Recommendation</version>
          <rep_platform>PC</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="Ying Lu">ying.lu</reporter>
          <assigned_to name="Don Chamberlin">chamberl</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>9923</commentid>
    <comment_count>0</comment_count>
    <who name="Ying Lu">ying.lu</who>
    <bug_when>2006-06-01 21:14:56 +0000</bug_when>
    <thetext>For the following query,

&lt;elem attr=&quot;val1&quot; attr=&quot;val2&quot; attr2=&quot;val3&quot;/&gt;

it can raise error XQST0040, according to XQuery specification section 3.7.1.1, &quot;If the attributes in a direct element constructor do not have distinct expanded QNames as their respective node-name properties, a static error is raised [err:XQST0040].&quot;

It can also raise error XQDY0025, based on section 3.7.1.3 bullet 5.d, &quot;attributes consist of all the attributes specified in the start tag as
described in 3.7.1.1 Attributes, together with all the attribute nodes in the
content sequence, in implementation-dependent order. If two or more of these
attributes have the same node-name, a dynamic error is raised [err:XQDY0025].&quot;

Should both error codes be allowed for the sample query? Please clarify.

Thanks,
Ying</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>9929</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2006-06-04 22:28:21 +0000</bug_when>
    <thetext>If a query contains a static error then the evaluation phase will never take place and therefore a dynamic error will never be raised. I think there&apos;s a clear distinction here between the static error that occurs when the attribute names are known statically, and the dynamic error that occurs when they are computed.

Michael Kay (personal response)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>9936</commentid>
    <comment_count>2</comment_count>
    <who name="Ying Lu">ying.lu</who>
    <bug_when>2006-06-05 18:37:22 +0000</bug_when>
    <thetext>If that is the intention, please clarify in the specification, as the section 3.7.1.3 bullet 5.d says, &quot;attributes consist of all the attributes specified in the start tag as described in 3.7.1.1 Attributes....&quot;

An implementation can choose to check the attribute name during the evaluation phase, therefore raise the dynamic error instead of the static error. Both are allowed in the current specification.

Thanks,
Ying</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>9949</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2006-06-06 16:59:25 +0000</bug_when>
    <thetext>The Working Group discussed this on 2006-06-06 and decided that no change to the specification is needed.

In a direct element constructor, the presence of two conflicting attributes is a static error, which means that it can and must be detected statically (which means it must be reported, using error code XQST0040, even if it occurs in code that is never executed). 

In a computed element constructor, it&apos;s not possible in general to detect the error statically. It&apos;s therefore defined as a dynamic error, and it&apos;s only mandatory to report the error if the code is actually executed. But note that section 2.3.1 says that dynamic errors &quot;may&quot; be detected during the static phase: in this case this means that if you use a computed element constructor and the compiler can work out in advance that the attribute names will conflict, it is allowed to report the error XQDY0025 statically.

I am closing this as &quot;Won&apos;t fix&quot;. If you feel there are issues that we haven&apos;t addressed here, please feel free to reopen the bug.

Michael Kay
for the XQuery Working Group</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>