<?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>22032</bug_id>
          
          <creation_ts>2013-05-14 20:41:04 +0000</creation_ts>
          <short_desc>[XQ30] Consistency between the node-name and namespaces of a constructed element</short_desc>
          <delta_ts>2013-06-19 10:14:36 +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 3.0</component>
          <version>Candidate Recommendation</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</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="Michael Kay">mike</reporter>
          <assigned_to name="Jonathan Robie">jonathan.robie</assigned_to>
          <cc>christian.gruen</cc>
          
          <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>87680</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2013-05-14 20:41:04 +0000</bug_when>
    <thetext>(From a comment by Christian Grün &lt;christian.gruen@gmail.com&gt; on the saxon-help list).

Consider

element e { namespace {&apos;&apos;} {&apos;u&apos;} }

The rules say that 

(a) the name of the element is Q{}e

(b) the element has a namespace binding (&quot;&quot;=&gt;&quot;u&quot;)

This would violate a consistency constraint in the data model (section 6.2.1 rule 12).

Possibilities are:

(1) change the name of the element to Q{u}e

(2) don&apos;t add the namespace binding to the element node

(3) raise a dynamic error

XSLT chooses (3). Specifically 

[ERR XTDE0440] It is a non-recoverable dynamic error if the result sequence contains a namespace node with no name and the element node being constructed has a null namespace URI (that is, it is an error to define a default namespace when the element is in no namespace).

Christian was expecting (1).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>87683</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2013-05-14 20:55:37 +0000</bug_when>
    <thetext>I have added test case nscons-042 to test this situation.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>87763</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2013-05-16 11:48:23 +0000</bug_when>
    <thetext>Reclassifying as XQuery. Previously misclassified.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>88008</commentid>
    <comment_count>3</comment_count>
    <who name="Jonathan Robie">jonathan.robie</who>
    <bug_when>2013-05-21 16:39:06 +0000</bug_when>
    <thetext>The Working Group has decided to raise a dynamic error for this case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>88009</commentid>
    <comment_count>4</comment_count>
    <who name="Jonathan Robie">jonathan.robie</who>
    <bug_when>2013-05-21 16:43:04 +0000</bug_when>
    <thetext>The error code for this will be XQDY0102.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89397</commentid>
    <comment_count>5</comment_count>
    <who name="Jonathan Robie">jonathan.robie</who>
    <bug_when>2013-06-17 13:12:30 +0000</bug_when>
    <thetext>Can I make this error more specific? Does the following text cover this case? I find it more readable:

It is an error to define a default namespace for an element  if the element&apos;s name is in no namespace  &lt;errorref class=&quot;DY&quot; code=&quot;0102&quot;/&gt;. For instance, the following computed constructor raises an error because the element&apos;s name is not in a namespace, but a default namespace is defined.

&lt;eg role=&quot;parse-test&quot;&gt;element e { namespace {&apos;&apos;} {&apos;u&apos;} }&lt;/eg&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89399</commentid>
    <comment_count>6</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2013-06-17 14:49:15 +0000</bug_when>
    <thetext>It&apos;s more readable, but is the term &quot;to define a default namespace for an element&quot; clear? You&apos;ve basically taken the informal readable description of the error condition in XSLT in preference to the more formal and accurate one.

In XSLT there are several ways a namespace node can find its way into the content sequence for an element constructor; in XQuery there is only one way, namely the use of a namespace constructor. So I agree the XQuery case is a little simpler. But I don&apos;t think I would understand &quot;define a default namespace&quot; as used here, except by reference to the example, and it&apos;s not good if the spec can only be understood by reference to examples.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89409</commentid>
    <comment_count>7</comment_count>
    <who name="Jonathan Robie">jonathan.robie</who>
    <bug_when>2013-06-17 19:37:35 +0000</bug_when>
    <thetext>How about this:

If the name of an element in a computed element constructor is in no namespace, creating a default namespace for that element using a computed namespace constructor is an error &lt;errorref class=&quot;DY&quot; code=&quot;0102&quot;/&gt;. For instance, the following computed constructor raises an error because the element&apos;s name is not in a namespace, but a default namespace is defined.

&lt;eg role=&quot;parse-test&quot;&gt;element e { namespace {&apos;&apos;} {&apos;u&apos;} }&lt;/eg&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89413</commentid>
    <comment_count>8</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2013-06-17 20:43:16 +0000</bug_when>
    <thetext>Much better, but doesn&apos;t the rule apply equally to a direct element constructor?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89426</commentid>
    <comment_count>9</comment_count>
    <who name="Jonathan Robie">jonathan.robie</who>
    <bug_when>2013-06-17 22:45:36 +0000</bug_when>
    <thetext>(In reply to comment #8)
&gt; Much better, but doesn&apos;t the rule apply equally to a direct element
&gt; constructor?

Hmmmphhh, yes it does.

If the name of an element in an element constructor is in no namespace, creating a default namespace for that element using a computed namespace constructor is an error &lt;errorref class=&quot;DY&quot; code=&quot;0102&quot;/&gt;. For instance, the following computed constructor raises an error because the element&apos;s name is not in a namespace, but a default namespace is defined.

&lt;eg role=&quot;parse-test&quot;&gt;element e { namespace {&apos;&apos;} {&apos;u&apos;} }&lt;/eg&gt;
[reply] [-] Comment 8</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>