<?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>17040</bug_id>
          
          <creation_ts>2012-05-11 16:44:05 +0000</creation_ts>
          <short_desc>[XQ30] Clarification on using defined prefixes in serialization and validate expr</short_desc>
          <delta_ts>2012-05-29 19:39:52 +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>Working drafts</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Cezar Andrei">cezar.andrei</reporter>
          <assigned_to name="Jonathan Robie">jonathan.robie</assigned_to>
          <cc>jim.melton</cc>
    
    <cc>mike</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>67619</commentid>
    <comment_count>0</comment_count>
    <who name="Cezar Andrei">cezar.andrei</who>
    <bug_when>2012-05-11 16:44:05 +0000</bug_when>
    <thetext>Should the declared prefixes be serialized?

Ex 1: explicit declaration
  declare namespace cat =&apos;mycat&apos;; 
  &lt;a t=&apos;cat:miau&apos;&gt;42&lt;/a&gt;
Should result in:
  &lt;a t=&apos;cat:miau&apos;&gt;42&lt;/a&gt;
or
  &lt;a xmlns:cat=&apos;mycat&apos; t=&apos;cat:miau&apos;&gt;42&lt;/a&gt;

Ex 2: implicit declaration of xsi and xs prefix
  &lt;a xsi:type=&apos;xs:integer&apos;&gt;42&lt;/a&gt;
Should result in:
  &lt;a xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:type=&quot;xs:integer&quot;&gt;42&lt;/a&gt;
or
  &lt;a xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; 
     xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot; 
     xsi:type=&quot;xs:integer&quot;&gt;42&lt;/a&gt;


Should the validate expression take into account the declared prefixes?

Ex 3: validate
  validate lax { &lt;a xsi:type=&apos;xs:integer&apos;&gt;42&lt;/a&gt; }
Should result in:
  Error: xs prefix not declared for QName value &apos;xs:integer&apos;.
or
  &lt;a xsi:type=&apos;xs:integer&apos;&gt;42&lt;/a&gt; with &apos;xs:integer&apos; being a valid QName and 42 being an integer in PSVI.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68025</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2012-05-22 20:39:48 +0000</bug_when>
    <thetext>I believe this is really a request for interpretation of the XQuery 1.0 specification, rather than a comment on 3.0. Correct me if I am wrong.

Note first that the serializer makes no decision about which namespaces to output. If a namespace is present in the result tree then it is serialized, if it is not present in the result tree, it is not serialized. The question concerns element construction and the namespace nodes/bindings that are added to elements during tree construction, which is largely covered in section 3.7.4 of the specification, and has nothing to do with serialization.

For the first example

declare namespace cat =&apos;mycat&apos;; 
  &lt;a t=&apos;cat:miau&apos;&gt;42&lt;/a&gt;

none of the conditions for creating a namespace binding for cat=&quot;mycat&quot; is satisfied; therefore it is not created. (If you want it created, write &lt;a t=&apos;cat:miau&apos; xmlns:cat=&apos;mycat&apos;&gt;42&lt;/a&gt;)

In the second example, the required conditions are satisifed for the xsi namespace (specifically, the namespace is used in the name of an attribtue), but not for the xs namespace.

As far as validation is concerned, the tree is constructed first, then validation takes place. The only namespaces known to the validator are those that are present on the tree being validated. If tree construction did not add a namespace to the element in question, then the validator will complain if it encounters QName-valued content that uses a prefix for which no binding is present on the tree.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68154</commentid>
    <comment_count>2</comment_count>
    <who name="Jonathan Robie">jonathan.robie</who>
    <bug_when>2012-05-25 21:15:31 +0000</bug_when>
    <thetext>Hi Cezar,

Do you agree with Mike Kay&apos;s analysis? Is there a bug in the XQuery 3.0 specificaiton that we should be aware of?  If not, I&apos;d like to close this BZ.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68265</commentid>
    <comment_count>3</comment_count>
    <who name="Jonathan Robie">jonathan.robie</who>
    <bug_when>2012-05-29 15:17:13 +0000</bug_when>
    <thetext>Hi Cezar, 

I&apos;m resolving this as invalid, because it does not mention a specific problem with the XQuery 3.0 specification. If I missed something, please reopen, and clearly state the problem that you see in the specification.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68277</commentid>
    <comment_count>4</comment_count>
    <who name="Cezar Andrei">cezar.andrei</who>
    <bug_when>2012-05-29 17:52:28 +0000</bug_when>
    <thetext>This is how I interpreted the first time, without these examples. But from an usability standpoint, in these cases, it&apos;s not the best answer. In the same time, the spec has to cover all cases, it&apos;s good that this is clarified now.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68278</commentid>
    <comment_count>5</comment_count>
    <who name="Cezar Andrei">cezar.andrei</who>
    <bug_when>2012-05-29 18:27:24 +0000</bug_when>
    <thetext>It would be really useful to have a set of tests added to the TCK for this matter.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68281</commentid>
    <comment_count>6</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2012-05-29 19:39:52 +0000</bug_when>
    <thetext>Thanks for the suggestion. I am adding these examples as tests to the QT3 test suite. In fact it appears there are currently no tests for a validate expression relying on xsi:type, so this is a welcome addition!</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>