<?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>5316</bug_id>
          
          <creation_ts>2007-12-11 14:24:38 +0000</creation_ts>
          <short_desc>[UPD] Rename: default namespace for attributes</short_desc>
          <delta_ts>2008-01-15 18:27:00 +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>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="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>18037</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2007-12-11 14:24:38 +0000</bug_when>
    <thetext>The expression

for $a in //@PRICE return
  rename $a as &quot;COST&quot;

is currently defined to treat COST as a name in the default namespace for elements and types, despite the fact that it is clearly being used as an attribute name. Presumably the system is supposed to invent a namespace prefix, since the name clearly cannot be used unprefixed (or is this supposed to lead to a data model consistency error?) Either way, this seems likely to cause unwelcome surprises.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18115</commentid>
    <comment_count>1</comment_count>
    <who name="Don Chamberlin">chamberl</who>
    <bug_when>2007-12-17 18:38:42 +0000</bug_when>
    <thetext>Michael,
Would you like to suggest a way to fix this problem?
--Don Chamberlin</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18116</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2007-12-17 18:51:04 +0000</bug_when>
    <thetext>My preferred solution would be to remove the option of supplying the new name as a string, and insist that it be supplied as a QName. We have a number of ways of getting a QName, including the xs:QName, fn:QName(), and fn:node-name() functions, and I think that allowing a simple string as a short-cut is not worth the ambiguities it creates.

An alternative would be to interpret a string differently depending on whether the node being renamed is an element or an attribute.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18292</commentid>
    <comment_count>3</comment_count>
    <who name="Don Chamberlin">chamberl</who>
    <bug_when>2008-01-14 23:10:43 +0000</bug_when>
    <thetext>The resolution of this bug should work for renaming PI&apos;s as well as attributes. I suggest that we revise Section 2.4.4 (Rename) by replacing Rules 2 and 3 with the following combined rule:

2. NewNameExpr must be a non-updating expression; otherwise a static error is raised [err:XUST0001]. NewNameExpr is processed as follows:

a. If $target is an element node, let $QName be the result of evaluating NewNameExpr as though it were the name expression of a computed element constructor [XQuery Section 3.7.3.1]. If the namespace binding of $QName conflicts with any namespace binding in the &quot;namespaces&quot; property of $target, a dynamic error is raised [err:XUDY0023].

b. If $target is an attribute node, let $QName be the result of evaluating NewNameExpr as though it were the name expression of a computed attribute constructor [XQuery Section 3.7.3.2]. If the namespace binding of $QName conflicts with any namespace binding in the &quot;namespaces&quot; property of the parent (if any) of $target, a dynamic error is raised [err:XUDY0023].

c. If $target is a processing instruction node, let $NCName be the result of evaluating NewNameExpr as though it were the name expression of a computed processing instruction constructor [XQuery Section 3.7.3.5], and let $QName be defined as fn:QName((), $NCName).  

In addition to the above replacement, Rule 4 becomes Rule 3 and error code XUDY0025 is eliminated.

Cheers,
--Don Chamberlin
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18322</commentid>
    <comment_count>4</comment_count>
    <who name="Don Chamberlin">chamberl</who>
    <bug_when>2008-01-15 18:26:48 +0000</bug_when>
    <thetext>On 15 Jan 2008, the working group adopted the proposal in Comment #3. Michael, since you were present at the discussion, I am marking this bug report as Closed.
--Don Chamberlin (for the working group)</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>