<?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>5631</bug_id>
          
          <creation_ts>2008-04-07 15:35:20 +0000</creation_ts>
          <short_desc>[UPD] rename and namespace inheritance</short_desc>
          <delta_ts>2011-01-07 11:34:16 +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>Candidate Recommendation</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>
          <cc>jim.melton</cc>
    
    <cc>jonathan.robie</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>19749</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2008-04-07 15:35:20 +0000</bug_when>
    <thetext>The specification of upd:rename() says (in 1.d and similarly in 2.e) &quot;The namespaces property of $target is modified to include a namespace binding derived from $newName, if this binding did not already exist.&quot;

Normally, and by default, when we create a namespace binding on an element then the same namespace binding is created on all its children, recursively, unless they carry an explicit redeclaration of that namespace prefix. We don&apos;t seem to be doing that here. Is this intentional? I would have thought it made sense to propagate the new namespace binding to descendants, or not, based on the &quot;inherit namespace&quot; option in the static context.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>21105</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2008-07-09 15:14:05 +0000</bug_when>
    <thetext>Further thoughts on possible resolution of this bug can be found at:

http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2008Jul/0014.html

(member-only link)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>23230</commentid>
    <comment_count>2</comment_count>
    <who name="Jim Melton">jim.melton</who>
    <bug_when>2009-01-23 01:53:36 +0000</bug_when>
    <thetext>In its teleconference of 2009-01-20, the XML Query WG accepted the proposal in http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2008Jul/0014.html (member-only link) as the resolution of this bug.  We are therefore marking this bug FIXED; because you were present when the solution was adopted (and, indeed, because you proposed the solution), we presume that you agree with that solution and we are therefore also marking the bug CLOSED. </thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>24943</commentid>
    <comment_count>3</comment_count>
    <who name="Jonathan Robie">jonathan.robie</who>
    <bug_when>2009-04-28 10:05:32 +0000</bug_when>
    <thetext>When I attempted to implement this, I realized that http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2008Jul/0014.html
 presents two different ways to handle the semantics of namespace propagation, and the minutes do not tell me which of these to use:

&lt;quote href=&quot;http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2008Jul/0014.html&quot;&gt;
  A difficulty with propagating namespaces is that it could cause new kinds of
  conflicts, and that the result could depend on the order in which operations
  on the PUL are applied. For example consider:

  &lt;a&gt;&lt;b/&gt;&lt;/a&gt;

  and an update that renames &lt;a&gt; to &lt;p:a xmlns:p=&quot;p.uri&quot;&gt; while renaming &lt;b&gt;
  to &lt;p:b xmlns:p=&quot;q.uri&quot;/&gt;. Then if the rename of &lt;a&gt; is done first, the
  rename of &lt;b&gt; would fail because the &lt;b&gt; element has acquired a conflicting
  namespace binding for the prefix &quot;p&quot;. But if &lt;b&gt; is renamed first, there is
  no conflict, because the propagation of the namespace binding will
  (presumably) stop when another binding of the same prefix is encountered.

  It is possible to solve this problem by doing all propagation of namespaces
  at the end, after all other update actions have been completed (but before
  revalidation). This can be done using a similar idea to the way we &quot;mark
  nodes for revalidation&quot;. Wherever we add a namespace binding to an element
  node, we &quot;mark the namespace binding for propagation&quot;, and after step 5 of
  upd:applyUpdates(), we add:

  5.1 For each namespace binding that is marked for propagation,
  upd:propagate-namespace($element, $prefix, $uri) is invoked, where $element
  is the element node on which the namespace binding appears, $prefix is the
  namespace prefix, and $uri is the namespace URI. 
&lt;/quote&gt;

Neither my notes nor the minutes tell me whether we decided to adopt this part, marked as &quot;possible&quot; in the proposal.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>24944</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2009-04-28 10:30:42 +0000</bug_when>
    <thetext>Yes, the record does seem to be a little bit unsatisfactory here, in that the proposal uses language that is rather tentative. However, my reading of the decision is that all parts of the proposal were accepted including the parts put forward only tentatively. 

Specifically, this means:

(1) In the following places we have to say that certain namespace bindings are marked for propagation:

The places where namespace bindings are marked for propagation are:

* on upd:insertBefore and upd:insertAfter all the namespace bindings of
parent($target) are marked for propagation

* on upd:insertInto, updInsertIntoAsFirst, and upd:insertIntoAsLast, all the
namespace bindings of $target are marked for propagation

* on upd:insertAttributes, any namespace bindings created in step 3b are
marked for propagation

* on upd:replaceNode, any namespace bindings created in step 4b are marked
for propagation

* on upd:rename, any namespace bindings created in step 1d or 2e is marked
for propagation

(2) We need to add upd:propagateNamespace() as follows:

The actual logic of upd:propagate-namespace($element, $prefix, $uri) is:

For each element $child among the children of $element that does not have a
namespace binding for $prefix, 

(a) add a namespace binding ($prefix, $uri) to $child

(b) call upd:propagate-namespace($child, $prefix, $uri)

(3) We add another parameter to upd:applyUpdates, being the copy mode from the static context (as with revalidation mode)

(4) after step 5 of upd:applyUpdates(), we add:

5.1 For each namespace binding that is marked for propagation, provided that copyMode is set to &quot;copy&quot;, upd:propagate-namespace($element, $prefix, $uri) is invoked, where $element is the element node on which the namespace binding appears, $prefix is the namespace prefix, and $uri is the namespace URI. 

Michael Kay
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>43899</commentid>
    <comment_count>5</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2011-01-07 11:34:16 +0000</bug_when>
    <thetext>The PR specification appears to implement the changes as listed in comment #4.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>