<?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>18838</bug_id>
          
          <creation_ts>2012-09-11 20:40:59 +0000</creation_ts>
          <short_desc>[Applet30] encoding becomes version in version declaration</short_desc>
          <delta_ts>2012-12-18 13:50:22 +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>Grammar Test Applets</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="Andrew Eisenberg">andrew.eisenberg</reporter>
          <assigned_to name="Michael Dyck">jmdyck</assigned_to>
          <cc>jim.melton</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>73626</commentid>
    <comment_count>0</comment_count>
    <who name="Andrew Eisenberg">andrew.eisenberg</who>
    <bug_when>2012-09-11 20:40:59 +0000</bug_when>
    <thetext>Test case version_declaration-023-v3 led me to look at 3 queries:

1)  xquery encoding &quot;utf-8&quot;; 1 eq 1

|         VersionDecl [1:0 - 1:24]
|            StringLiteral &quot;utf-8&quot; [2:17 - 1:23]
|            Separator [2:17 - 1:24]

  &lt;xqx:versionDecl&gt;
    &lt;xqx:version&gt;utf-8&lt;/xqx:version&gt;
    &lt;!-- encoding: null --&gt;
  &lt;/xqx:versionDecl&gt;

2)  xquery version &quot;utf-8&quot;; 1 eq 1

|         VersionDecl [1:0 - 1:23]
|            StringLiteral &quot;utf-8&quot; [2:16 - 1:22]
|            Separator [2:16 - 1:23]

  &lt;xqx:versionDecl&gt;
    &lt;xqx:version&gt;utf-8&lt;/xqx:version&gt;
    &lt;!-- encoding: null --&gt;
  &lt;/xqx:versionDecl&gt;

3) xquery version &quot;utf-8&quot; encoding &quot;utf-9&quot;; 1 eq 1

|         VersionDecl [1:0 - 1:40]
|            StringLiteral &quot;utf-8&quot; [2:16 - 1:22]
|            StringLiteral &quot;utf-9&quot; [2:33 - 1:39]
|            Separator [2:33 - 1:40]

  &lt;xqx:versionDecl&gt;
    &lt;xqx:version&gt;utf-8&lt;/xqx:version&gt;
    &lt;!-- encoding: &quot;utf-9&quot; --&gt;
  &lt;/xqx:versionDecl&gt;


The first of these is turning an encoding into a version. Our parser needs to generate a parse tree that distinguishes the string literal that represents an encoding from a string literal that represents a version.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>73705</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Dyck">jmdyck</who>
    <bug_when>2012-09-12 17:17:25 +0000</bug_when>
    <thetext>Thanks for spotting this. I&apos;ve now fixed it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>73940</commentid>
    <comment_count>2</comment_count>
    <who name="Andrew Eisenberg">andrew.eisenberg</who>
    <bug_when>2012-09-14 19:40:10 +0000</bug_when>
    <thetext>I believe that some further work is needed here. The first of these queries:

xquery encoding &quot;utf-8&quot;; 1 eq 1

now generates:

  &lt;xqx:versionDecl&gt;
    &lt;!-- encoding: &quot;utf-8&quot; --&gt;
  &lt;/xqx:versionDecl&gt;

which transforms into:

xquery ;
(1 eq 1)

which is invalid.


Possible solutions:

1) our applet should be generate:

  &lt;xqx:versionDecl&gt;
    &lt;xqx:encoding&gt;utf-8&lt;/xqx:encoding&gt;
  &lt;/xqx:versionDecl&gt;


2) our applet should generate no versionDecl element at all

3) XQueryX should transform this versionDecl element into &quot;&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>74016</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Dyck">jmdyck</who>
    <bug_when>2012-09-18 01:42:36 +0000</bug_when>
    <thetext>Note that an empty &lt;xqx:versionDecl&gt; is schema-valid, so the question of how the (normative) XQueryX-to-XQuery stylesheet handles such a thing is independent of whether the (non-normative) XQuery-to-XQueryX converter generates such a thing.

-----------------------------------
re the XQuery-to-XQueryX converter:

The code doesn&apos;t say why it generates:

  &lt;xqx:versionDecl&gt;
    &lt;!-- encoding: &quot;utf-8&quot; --&gt;
  &lt;/xqx:versionDecl&gt;

instead of:

  &lt;xqx:versionDecl&gt;
    &lt;xqx:encoding&gt;utf-8&lt;/xqx:encoding&gt;
  &lt;/xqx:versionDecl&gt;

(It&apos;s been doing so since the earliest version of the converter that I can find, dated 2005-10-16.) I suspect it&apos;s because the encoding of the original XQuery query isn&apos;t (or shouldn&apos;t be?) pertinent to the encoding of the resulting XQueryX query. Of course, we don&apos;t require that the declared encoding be correct (&quot;since the encoding of a query may change as the query moves from one environment to another&quot;), so it wouldn&apos;t be wrong to include the &lt;xqx:encoding&gt;.

Personally, I think I&apos;d prefer an &lt;xqx:encoding&gt; over a comment (or no &lt;xqx:versionDecl&gt;), because the test suite has certain tests whose point is to elicit XQST0087 (malformed encoding string), and the corresponding XQueryX tests (generated by the converter) currently don&apos;t do so, because the offending encoding string is in a comment.

------------------------------------
re the XQueryX-to-XQuery stylesheet:

The XQueryX spec doesn&apos;t guarantee that the stylesheet will transform every schema-valid XQueryX query into a valid XQuery query, so producing
    xquery ;
    (1 eq 1)
is not technically wrong. However, it is undesirable. Probably the stylesheet should transform an empty &lt;xqx:versionDecl&gt; into the empty string, as you suggest.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>74043</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Dyck">jmdyck</who>
    <bug_when>2012-09-18 15:48:58 +0000</bug_when>
    <thetext>At its meeting today, the WG made the following determinations:

re the XQuery-to-XQueryX converter:
-- The 1.0 converter code can generate at most a comment for the encoding because the XQueryX 1.0 schema doesn&apos;t have an &lt;xqx:encoding&gt; element.
-- The 3.0 converter code should generate an &lt;xqx:encoding&gt; element. (Given that, it will never generate an empty &lt;xqx:versionDecl&gt;.)

re the XQueryX-to-XQuery stylesheet:
-- The schema will be changed to outlaw an empty &lt;xqx:versionDecl&gt; (i.e., it will require at least one of an &lt;xqx:version&gt; or an &lt;xqx:encoding&gt;, to parallel the XQuery syntax). Given that, the stylesheet doesn&apos;t need to change.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80324</commentid>
    <comment_count>5</comment_count>
    <who name="Michael Dyck">jmdyck</who>
    <bug_when>2012-12-18 06:45:40 +0000</bug_when>
    <thetext>(In reply to comment #4)
&gt;
&gt; re the XQuery-to-XQueryX converter:
&gt; -- The 3.0 converter code should generate an &lt;xqx:encoding&gt; element. (Given
&gt; that, it will never generate an empty &lt;xqx:versionDecl&gt;.)

I made this change on 2012-09-21.

&gt; re the XQueryX-to-XQuery stylesheet:
&gt; -- The schema will be changed to outlaw an empty &lt;xqx:versionDecl&gt; (i.e., it
&gt; will require at least one of an &lt;xqx:version&gt; or an &lt;xqx:encoding&gt;, to
&gt; parallel the XQuery syntax).

Jim Melton made this change on 2012-09-24.

Therefore, I&apos;m marking this bug Resolved-fixed.
Andrew, if you agree with the resolution, please mark the bug Closed.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>