<?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>5334</bug_id>
          
          <creation_ts>2008-01-01 22:15:06 +0000</creation_ts>
          <short_desc>[UPD] Inserting attributes</short_desc>
          <delta_ts>2008-01-26 22:59:13 +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>Update Facility</component>
          <version>Last Call drafts</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="Michael Kay">mike</reporter>
          <assigned_to name="Andrew Eisenberg">andrew.eisenberg</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>18173</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2008-01-01 22:15:06 +0000</bug_when>
    <thetext>The rules on insertion of attributes seem highly arbitrary.

You are allowed to say

insert node @a after $x/*[12]

and it happily adds a copy of @a to $x, ignoring the requested position.

You can also say

insert nodes (@a, &lt;e/&gt;) after $x/*[12]

and it happily inserts @a as an attribute of $x, and adds &lt;e/&gt; as its 13th child element.

But you can&apos;t say

insert nodes (&lt;e/&gt;, @a) after $x/*[12]

because the source expression isn&apos;t allowed to have an attribute appearing after a non-attribute.

This seems very inconsistent. I would suggest either relaxing the rules by eliminating error XUTY0004, or making the rules stricter by disallowing all use of positional qualifiers (after, before, as first, as last) when the source expression contains an attribute.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18299</commentid>
    <comment_count>1</comment_count>
    <who name="Don Chamberlin">chamberl</who>
    <bug_when>2008-01-15 01:09:54 +0000</bug_when>
    <thetext>Eliminating XUTY0004 seems reasonable. It was defined by analogy with XQTY0024, but it could be argued that the analogy is weak because XQTY0024 applies only to element constructors.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18325</commentid>
    <comment_count>2</comment_count>
    <who name="zhen hua liu">zhen.liu</who>
    <bug_when>2008-01-15 19:29:32 +0000</bug_when>
    <thetext>I&apos;d like to retain what the current xquery update spec states, that is, XUTY0004 to be raised for the following reasons:
(1) It is consistent with the xquery 1.0 for element constructor for raising 
XQTY0024 error.
(2) The original reason, I suspected, that XQTY0024 error is raised for element
constructor, is for streaming implementation. I think similar arguments held for
insert node.
(3) Some implementations may rewrite (transform) some &apos;insert expression&apos; into
element constructor. In such case, it is appreciated they share the same rules.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18462</commentid>
    <comment_count>3</comment_count>
    <who name="Jonathan Robie">jonathan.robie</who>
    <bug_when>2008-01-22 19:56:39 +0000</bug_when>
    <thetext>In XQuery 1.0, this raises an error:

let $x := 
 ( attribute a { &quot;a&quot; },
   element b { &quot;b&quot; },
   attribute c { &quot;c&quot; } )
return 
&lt;foo&gt;
 { $x }
&lt;/foo&gt;

That leads me to expect the following to be an error:

let $x := 
 ( attribute a { &quot;a&quot; },
   element b { &quot;b&quot; },
   attribute c { &quot;c&quot; } )
let $f := &lt;foo&gt;&lt;/foo&gt;
return insert nodes $x into $f
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18467</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2008-01-22 20:47:11 +0000</bug_when>
    <thetext>Concerning comment #3: yes, for &quot;insert into&quot; that would be a reasonable expectation. What makes it unreasonable is that we allow &quot;insert after&quot; to insert a new attribute &quot;after&quot; an existing child element. If there&apos;s an existing child &lt;c/&gt; and we can insert (@a, &lt;e/&gt;) after &lt;c/&gt;, then clearly this involves some rearrangement of the sequence (@a, &lt;e/&gt;); and if this sequence can be rearranged, then so can (&lt;e/&gt;, @a).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18598</commentid>
    <comment_count>5</comment_count>
    <who name="Don Chamberlin">chamberl</who>
    <bug_when>2008-01-26 22:04:41 +0000</bug_when>
    <thetext>Michael,
On 22 Jan 2008, the Query Working Group decided not to make any change to the Update specification based on this bug report. The reason for this decision is to preserve consistency between insert expressions and element constructors in XQuery 1.0. If you are satisfied with this resolution, please change the status of this bug to Closed.
--Don Chamberlin (for the Query Working Group)</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>