Bug 6535 - [SER 1.1]: Add new serialization option suppress-indentation
Summary: [SER 1.1]: Add new serialization option suppress-indentation
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Serialization 3.0 (show other bugs)
Version: Recommendation
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Henry Zongaro
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
Depends on:
Reported: 2009-02-06 09:58 UTC by Michael Kay
Modified: 2010-01-04 22:02 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Michael Kay 2009-02-06 09:58:56 UTC
There is a class of XML documents - our errata documents are a good example - that contain "data" at the upper levels of the content hierarchy, and narrative text further down the hierarchy. Atom feeds are another example: the top-level structure contains metadata, and inside this there is a "content" element that holds XHTML.

The nicest way to serialize such documents - exemplified by the way the Atom spec shows its examples - is to use indentation for the "data" part, and to suppress indentation for the "narrative" part.

If the result document is schema-validated, specifying indent="yes" will tend to achieve this, because we specify that indentation should not apply within elements that have mixed content. But usually there is no schema, and it would be useful to be able to achieve the same effect in that case also.

I propose a new serialization property suppress-indentation whose value is a list of QNames. If this property is specified in conjunction with indent="yes", then its effect is to modify the rules for indentation by specifying that no whitespace is to be added to the output within the content (at any depth) of an element whose name appears in the list of QNames. If indent="no" is specified then the attribute is ignored, except that it must still be a syntactally valid list of QNames. The default value is an empty list.

The property behaves like cdata-section-elements in its surface syntax in XSLT and XQuery, and in XSLT its override behavior follows cdata-section-elements in that overriding definitions are additive.

The property should also be useful in purely narrative documents like those using the xmlspec DTD; suppress-indentation="p" to suppress indentation below the paragraph level would be a significant improvement on the results currently obtained.
Comment 1 Jim Melton 2009-03-20 02:09:47 UTC
At its F2F meeting on 2009-02-23 through 2009-02-25, the WG resolved to adopt the suggestion recorded in the bug.  As a result, I am marking this bug RESOLVED/FIXED.  If you agree with this resolution, please mark the bug CLOSED. 
Comment 2 Michael Kay 2009-03-20 08:55:28 UTC
Marked as closed.

Editor's draft of XSLT 2.1 has been updated accordingly.
Comment 3 Henry Zongaro 2010-01-04 22:02:45 UTC
Updated editor's draft of Serialization 1.1.