<?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>29273</bug_id>
          
          <creation_ts>2015-11-09 15:49:52 +0000</creation_ts>
          <short_desc>[SER31] Adaptive Serialization: serialization of strings, result of fn:string</short_desc>
          <delta_ts>2015-11-18 13:41:44 +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>Serialization 3.1</component>
          <version>Candidate Recommendation</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>RESOLVED</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="Christian Gruen">christian.gruen</reporter>
          <assigned_to name="C. M. Sperberg-McQueen">cmsmcq</assigned_to>
          <cc>abel.braaksma</cc>
    
    <cc>andrew_coleman</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>124135</commentid>
    <comment_count>0</comment_count>
    <who name="Christian Gruen">christian.gruen</who>
    <bug_when>2015-11-09 15:49:52 +0000</bug_when>
    <thetext>The spec states that, for adaptive serialization, &quot;an instance of xs:string or xs:untypedAtomic is serialized by enclosing the value in double quotation marks and doubling any quotes within the value; or optionally by enclosing the value in apostrophes and doubling any apostrophes within the value.&quot;

Ampersand characters should probably be represented as &quot;&amp;amp;&quot;.
The same rule could be applied to value of any other type: Right now, the spec says that &quot;VAL is the result of applying the fn:string() function&quot;, but it may not immediately be clear how the result is going to look like if fn:string() yields ampersands or quotes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124137</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2015-11-09 16:55:40 +0000</bug_when>
    <thetext>&gt;Ampersand characters should probably be represented as &quot;&amp;amp;&quot;.

I don&apos;t agree. XQuery doesn&apos;t require ampersands to be escaped in a string literal, and XPath doesn&apos;t even allow it. We shouldn&apos;t encourage users to think of using XML escaping outside XML text and attribute nodes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124138</commentid>
    <comment_count>2</comment_count>
    <who name="Christian Gruen">christian.gruen</who>
    <bug_when>2015-11-09 17:02:24 +0000</bug_when>
    <thetext>&gt; I don&apos;t agree. XQuery doesn&apos;t require ampersands to be escaped in a string
&gt; literal, and XPath doesn&apos;t even allow it. We shouldn&apos;t encourage users to
&gt; think of using XML escaping outside XML text and attribute nodes.

I didn’t reflect about XPath; but the XQuery grammar for string literals is as follows:

[222] StringLiteral ::= (&apos;&quot;&apos; (PredefinedEntityRef | CharRef | EscapeQuot | [^&quot;&amp;])* &apos;&quot;&apos;) | (&quot;&apos;&quot; (PredefinedEntityRef | CharRef | EscapeApos | [^&apos;&amp;])* &quot;&apos;&quot;)

So I was assuming that ampersands would always need to be escaped? And otherwise, &quot;&amp;amp;&quot; would be ambiguous, as long as the ampersand character *may* be escaped?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124139</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2015-11-09 17:23:00 +0000</bug_when>
    <thetext>Yes, of course, you are right: XQuery requires ampersands to be escaped in string literals. I have never understood why.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124254</commentid>
    <comment_count>4</comment_count>
    <who name="Andrew Coleman">andrew_coleman</who>
    <bug_when>2015-11-18 13:41:44 +0000</bug_when>
    <thetext>The WG decided to adopt the proposal described in the following message
https://lists.w3.org/Archives/Public/public-xsl-query/2015Nov/0035.html

This also addresses bug 29272</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>