This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 29890 - [SER31] Arrays in sequence normalization
Summary: [SER31] Arrays in sequence normalization
Status: RESOLVED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Serialization 3.1 (show other bugs)
Version: Candidate Recommendation
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: C. M. Sperberg-McQueen
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-03 09:55 UTC by Tim Mills
Modified: 2016-10-07 13:28 UTC (History)
1 user (show)

See Also:


Attachments

Description Tim Mills 2016-10-03 09:55:08 UTC
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:

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

So this is equivalent to 

document { 1 }

which can be serialized.

Now compare with 

[1]

In SER31, 2 Sequence Normalization, we read:

"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."

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't occur.

If I'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?
Comment 1 Andrew Coleman 2016-10-07 13:28:03 UTC
At the meeting on 2016-10-04, the WG agreed to resolve this by adding the sentence
"Each item in the sequence that is an array is flattened by calling the function
array:flatten() before being copied."
to the end of section 2 (Sequence Normalization) bullet 1.

Action A-656-02 was opened to track this