<?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>29890</bug_id>
          
          <creation_ts>2016-10-03 09:55:08 +0000</creation_ts>
          <short_desc>[SER31] Arrays in sequence normalization</short_desc>
          <delta_ts>2016-10-07 13:28:03 +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="Tim Mills">tim</reporter>
          <assigned_to name="C. M. Sperberg-McQueen">cmsmcq</assigned_to>
          <cc>andrew_coleman</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>127625</commentid>
    <comment_count>0</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2016-10-03 09:55:08 +0000</bug_when>
    <thetext>Consider

document { [1] }

The content expression of a document node constructor is processed in exactly the same way as an enclosed expression in the content of a direct element constructor, as described in Step 1e of 3.9.1.3 Content. 

In XQ31 3.9.1.3 Content, point 1.e.i. we read:

&quot;Each array returned by the enclosed expression is flattened by calling the function array:flatten() before the steps that follow.&quot;

So this is equivalent to 

document { 1 }

which can be serialized.

Now compare with 

[1]

In SER31, 2 Sequence Normalization, we read:

&quot;Where the process of converting the input sequence to a normalized sequence indicates that a value MUST be cast to xs:string, that operation is defined in Section 19.1.1 Casting to xs:string and xs:untypedAtomic FO31 of [XQuery and XPath Functions and Operators 3.1]. Where a step in the sequence normalization process indicates that a node should be copied, the copy is performed in the same way as an XSLT xsl:copy-of instruction that has a validation attribute whose value is preserve and has a select attribute whose effective value is the node, as described in Section 11.9.2 Deep Copy XT30 of [XSL Transformations (XSLT) Version 3.0], or equivalently in the same way as an XQuery content expression as described in Step 1e of Section 3.9.1.3 Content XQ31 of [XQuery 3.1: An XML Query Language], where the construction mode is preserve.&quot;

This refers to Step 1e, but this is only invoked when copying nodes, not function items.

So it would appear that

[1]

cannot be serialized, because the array flattening doesn&apos;t occur.

If I&apos;m correct, I think this marks the first time that serialization of

document { E }

and

E

behave differently under serialization (other than in error code).

Was this intentional?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127700</commentid>
    <comment_count>1</comment_count>
    <who name="Andrew Coleman">andrew_coleman</who>
    <bug_when>2016-10-07 13:28:03 +0000</bug_when>
    <thetext>At the meeting on 2016-10-04, the WG agreed to resolve this by adding the sentence
&quot;Each item in the sequence that is an array is flattened by calling the function
array:flatten() before being copied.&quot;
to the end of section 2 (Sequence Normalization) bullet 1.

Action A-656-02 was opened to track this</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>