Bug 20245 - [SER30] Empty elements in XHTML output method
Summary: [SER30] Empty elements in XHTML output method
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Serialization 3.0 (show other bugs)
Version: Last Call drafts
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Henry Zongaro
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-05 14:51 UTC by Michael Kay
Modified: 2013-01-15 22:27 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Kay 2012-12-05 14:51:59 UTC
Reading the draft of 2012-10-02, section 6, first two bullets, we read (my numbering):

(1) If (1x) an element node that has no child nodes is recognized as an HTML element, and
(1a) the html-version serialization parameter is absent or has a value less than 5.0, and the content model of the HTML element is not EMPTY (for example, an empty title or paragraph); or
(1b) the value of the html-version serialization parameter is 5.0, and the HTML element is not a void element,
(1c) the serializer MUST NOT use the minimized form. That is, it MUST output <p></p> and not <p />.

(2) If (2x) an element that has no children is recognized as an HTML element, and
(2a) the html-version serialization parameter is absent or has a value less than 5.0, and the content model of the HTML element is EMPTY (for example, an empty title or paragraph); or
(2b) the value of the html-version serialization parameter is 5.0, and the HTML element is not a void element,
(2c) the serializer MUST use the minimized tag syntax, for example <br />

After much staring at this, I think that

(A) in (2b), "is not a void element" should read "is a void element"

(B) in (2a), the example should refer to say hr and img rather than to title and paragraph.

I think the rules would be easier to read with some refactoring. I would suggest:

[Definition] An element is *always-empty* if either (a) the html-version serialization parameter is absent or has a value less than 5.0 and the content model is EMPTY (that is, it is one of the elements "area", "base", "basefont", "br", "col", "embed", "frame", "hr", "img", "input", "isindex", "link", "meta", "param"), or (b) the html-version serialization parameter has the value 5.0 and the element is a void element in HTML5, that is it is one of "area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"

If an element node that has no child nodes is recognized as an HTML element then:

(a) if the element is *always-empty* then the serializer MUST use the minimized tag syntax (for example it must use <br />), and if the html-version serialization parameter is absent or has a value less than 5.0, it MUST include a space before the trailing />, e.g. <br />, <hr /> and <img src="karen.jpg" alt="Karen" />.

(b) otherwise (the element is not *always-empty*), the serializer MUST NOT use the minimized tag syntax (for example it must use <p></p>)

This leaves the serializer to its own discretion for elements not recognized as HTML elements, and perhaps the rule should say this explicitly.
Comment 1 Henry Zongaro 2012-12-05 18:55:59 UTC
I agree.  Thank you for pointing out my mistakes and the suggestion for improved wording.
Comment 2 Henry Zongaro 2012-12-21 05:19:53 UTC
Michael, at their joint teleconference of 18 December 2012,[1] the XSLT and XQuery working groups agreed with your assessment that

(A) in (2b), "is not a void element" should read "is a void element"
(B) in (2a), the example should refer to say hr and img rather than to title and paragraph.

They also agreed that some editorial rewording along the lines you recommended was in order.

I will apply the substantive corrections for the next public working draft, and the editorial corrections in the working draft that will follow that one.

As you were present when these decisions were made, I will mark the bug as closed.

[1] https://lists.w3.org/Archives/Member/w3c-xsl-query/2012Dec/0054.html (Member-only link)
Comment 3 Henry Zongaro 2013-01-15 15:35:14 UTC
Michael, I have applied some editorial changes for this bug to section 6 of the latest internal working draft of Serialization.[2]  I would be grateful if you could take a look at the changes to see whether they are satisfactory.

[2] https://www.w3.org/XML/Group/qtspecs/specifications/xslt-xquery-serialization-30/html/Overview.html#xhtml-output
Comment 4 Michael Kay 2013-01-15 22:27:01 UTC
Yes, this looks fine. Thanks.