<?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>4151</bug_id>
          
          <creation_ts>2007-01-05 21:14:55 +0000</creation_ts>
          <short_desc>[XQuery] XQTY0086 description is too limited</short_desc>
          <delta_ts>2007-03-19 22:32: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>XQuery 1.0</component>
          <version>Proposed 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="Don Chamberlin">chamberl</assigned_to>
          <cc>hrennau</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>13357</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2007-01-05 21:14:55 +0000</bug_when>
    <thetext>One of my users is struggling with the problem of how to use XQuery to make an amended copy of elements with namespace-sensitive content. It really isn&apos;t easy (in fact, I don&apos;t think it&apos;s possible in general); but that&apos;s a subject for vendor extensions now and for XQuery 1.1 in due course.

Meanwhile, there&apos;s a situation that the spec doesn&apos;t seem to address. Consider the construct

element { node-name($t) } {
    $e/@*, $e/*
  }

where construction mode is preserve, and one of the attributes is typed as a QName. I think this should give error XQTY0086. But the current description of XQTE0086 is too narrow. It says:

&lt;quote&gt;
It is a type error [err:XQTY0086] in this case [where copy-namespaces mode specifies no-preserve] if the typed value of the copied element or of any of its attributes is namespace-sensitive.
&lt;/quote&gt;

But in this example the namespace-sensitive attribute does not belong to a copied element, and that&apos;s a problem regardless of the copy-namespaces mode.

The equivalent XSLT error condition is wider:

&lt;quote&gt;
[ERR XTTE0950] It is a type error to use the xsl:copy or xsl:copy-of instruction to copy a node that has namespace-sensitive content if the copy-namespaces attribute has the value no and its explicit or implicit validation attribute has the value preserve. It is also a type error if either of these instructions (with validation=&quot;preserve&quot;) is used to copy an attribute having namespace-sensitive content, unless the parent element is also copied. A node has namespace-sensitive content if its typed value contains an item of type xs:QName or xs:NOTATION or a type derived therefrom. The reason this is an error is because the validity of the content depends on the namespace context being preserved.
&lt;/quote&gt;

I think this needs a new clause, perhaps between D and E, along the lines:

&lt;proposed&gt;
D2 If construction mode is preserve, and the value of an enclosed expression includes an attribute node whose typed value is namespace-sensitive, then error [err:XQTY0086] is raised.
&lt;/proposed&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13395</commentid>
    <comment_count>1</comment_count>
    <who name="Hans-Juergen Rennau">hrennau</who>
    <bug_when>2007-01-09 22:56:13 +0000</bug_when>
    <thetext>Probably the only way out, but the implied restriction is a pity: a general impossibility to incorporate detached namespace-sensitive attributes during construction. 

An alternative which comes to mind is probably unacceptable, but let me nevertheless describe it: to accept the attribute without error IF the in-scope namespaces of the receptor element include a namespace binding matching the namespace binding implied by the QName/Notation value. Thus one could &quot;prepare&quot; the receptor, if necessary. An obvious problem however would be that the receptor&apos;s namespace bindings themselves are only finalized by analyzing the attributes (3.7.4). Thus we would get an unpleasant mixture: some attributes creating namespace bindings, and others requiring them.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>14234</commentid>
    <comment_count>2</comment_count>
    <who name="Jim Melton">jim.melton</who>
    <bug_when>2007-02-26 00:34:33 +0000</bug_when>
    <thetext>The fix for this bug does not appear in the Recommendation of 23 January 2007. 
It will be considered for a future publication (either an Errata document or
some possible future version of the specification).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>14478</commentid>
    <comment_count>3</comment_count>
    <who name="Don Chamberlin">chamberl</who>
    <bug_when>2007-03-19 22:31:25 +0000</bug_when>
    <thetext>Michael,
The Query Working Group has discussed your comment and agreed to add a new rule in Section 3.7.1.3, following the current Rule 1.e.ii.D, as follows: 

An enclosed expression in the content of an element constructor
may cause one or more existing nodes to be copied. Type error XQTY0086
is raised if:

(a) An element node is copied, and the typed value of the element node
or one of its attributes is namespace-sensitive, and construction mode
is preserve, and copy-namespaces mode is no-preserve. 

(b) An attribute node is copied but its parent element node is not
copied, and the typed value of the copied attribute node is 
namespace-sensitive, and construction mode is preserve.

(NOTE: Explanation of XQTY0086: It is
not possible to preserve the type of a QName without also preserving
the namespace binding that defines the prefix of the QName.)

This new rule (and related editorial changes) will appear in a future XQuery errata document.

Since you were present for the discussion of this bug report, I have marked the report as Fixed and Closed.

Regards,
Don Chamberlin (for the Query Working Group)</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>