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 30086 - [SER31] Indent=yes does not allow adding document-level whitespace
Summary: [SER31] Indent=yes does not allow adding document-level whitespace
Status: RESOLVED INVALID
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Serialization 3.1 (show other bugs)
Version: Recommendation
Hardware: PC All
: 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: 2017-04-12 20:56 UTC by Michael Kay
Modified: 2017-04-12 21:01 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2017-04-12 20:56:08 UTC
The serialization spec (3.0 and 3.1), XML method with indent="yes", does not allow addition of whitespace after the XML declaration or at the end of the document, or before or after document-level comments and processing instructions. The 2.0 spec did allow such whitespace to be added.

I think this is probably an oversight rather than an intentional change.

I think users would be upset if I changed my product to conform to this rule. See for example:

http://stackoverflow.com/questions/43375117/transformer-transform-writes-the-first-tag-on-the-same-line-as-xml/43379194#43379194

I suggest adding to section 5.1.4:

Whitespace characters MAY be added, elided or replaced at any place where it is permitted by the XML grammar provided that it is not in the content of an element (for example, after the XML declaration, or between document-level comments).

(This is actually more liberal than the 2.0 spec which does not allow whitespace to be inserted between adjacent top-level comments.)
Comment 1 Michael Kay 2017-04-12 21:01:59 UTC
I missed part of rule 2:

Whitespace characters MAY be added ... outside the content of any element.