[Bug 20245] New: [Ser 3.0] Empty elements in XHTML output method

https://www.w3.org/Bugs/Public/show_bug.cgi?id=20245

            Bug ID: 20245
           Summary: [Ser 3.0] Empty elements in XHTML output method
    Classification: Unclassified
           Product: XPath / XQuery / XSLT
           Version: Last Call drafts
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Serialization 3.0
          Assignee: zongaro@ca.ibm.com
          Reporter: mike@saxonica.com
        QA Contact: public-qt-comments@w3.org

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.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Wednesday, 5 December 2012 14:52:01 UTC