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 28626 - [QT3TS] Serialization-xhtml-4
Summary: [QT3TS] Serialization-xhtml-4
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XQuery 3 & XPath 3 Test Suite (show other bugs)
Version: Working drafts
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: O'Neil Delpratt
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-12 13:42 UTC by Tim Mills
Modified: 2015-06-24 13:55 UTC (History)
1 user (show)

See Also:


Attachments

Description Tim Mills 2015-05-12 13:42:54 UTC
This test and others in this group expect a minimized tag syntax of <x/> rather than <x /> (or indeed <x     />).  While the specification permits this when html-version is 5.0 or more, it does not mandate it.

Quoting the specification:


If an element that has no children is expected to be empty,

the serializer MUST use the minimized tag syntax, for example <br />, as the alternative syntax <br></br> allowed by XML gives uncertain results in many legacy user agents. If the html-version serialization parameter is absent or has a value less than 5.0, the serializer MUST include a space before the trailing />, e.g. <br />, <hr /> and <img src="karen.jpg" alt="Karen" />.
Comment 1 Michael Kay 2015-05-12 14:06:51 UTC
I'm happy to fix this one, but can't guarantee to find all instances unless you list them.

The tests here were pretty much auto-generated by converting Henry's HTML5 tests, and the results haven't been carefully inspected except to ensure that they match Saxon's results.

Indeed, I see that I've auto-converted a number of place-holder tests that Henry never completed, and that do nothing useful - I'll get rid of those.
Comment 2 Tim Mills 2015-05-13 11:46:26 UTC
Thanks.  I've enumerated the affected tests below.

Serialization-xhtml-1a
  * Should permit <XXX\s*/> because html-version="4.0" and the elements are not in the XHTML namespace.


Serialization-xhtml-20
  * Should permit <html /> because html-version="4.0" and <html> is not in the XHTML namespace.


Serialization-xhtml-23
  * Should permit <foo /> because html-version="4.0" and <foo> is not in the XHTML namespace.

Serialization-xhtml-24
  * Should permit <foo/> or <foo /> because html-version="5.0" and <foo> is not an HTML element.

Serialization-xhtml-35
  * Should permit <html /> because html-version="4.0" so <html> is not HTML element "html".

Serialization-xhtml-39
  * Should permit <html><head /></html> because html-version="4.0" so <head> is not HTML element "head".
Comment 3 Michael Kay 2015-06-23 13:31:02 UTC
Tim, as far as I can see, for most of these, the element is not "expected to be empty" (because html-version=4 and the elements are in no namespace) and therefore minimised tag syntax must not be used. Have I misunderstood something?
Comment 4 Tim Mills 2015-06-23 14:52:39 UTC
(In reply to Michael Kay from comment #3)
> Tim, as far as I can see, for most of these, the element is not "expected to
> be empty" (because html-version=4 and the elements are in no namespace) and
> therefore minimised tag syntax must not be used. Have I misunderstood
> something?


You're correct.  I'd been caught out by the change from 1.0, where the rule only applied when the element was an XHTML element.

* Given an empty instance of an XHTML element whose content model is not EMPTY (for example, an empty title or paragraph) the serializer MUST NOT use the minimized form. That is, it MUST output <p></p> and not <p />.

( If an element that has no children is an XHTML element with an EMPTY content model, the serializer MUST use the minimized tag syntax, for example <br />, as the alternative syntax <br></br> allowed by XML gives uncertain results in many existing user agents. The serializer MUST include a space before the trailing />, e.g. <br />, <hr /> and <img src="karen.jpg" alt="Karen" />.

I'll recheck these before closing...
Comment 5 Tim Mills 2015-06-23 15:35:01 UTC
My revised list is:

Serialization-xhtml-2


   <test-case name="Serialization-xhtml-2" >
      <description>
        With html-version=5, empty elements are serialized using self-closing tags including a space,
        and are recognized when in no namespace</description>
      <created by="Henry Zongaro" on="2012-10-26"/>
      <modified by="O'Neil Delpratt" on="2013-05-30" change="added dependency inline with bug issue #21868"/>
      <modified by="Michael Kay" on="2015-04-09" change="created XHTML version of HTML serialization test"/>
      <test><![CDATA[
declare boundary-space strip;        
declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";
declare option output:method  "xhtml";
declare option output:indent  "no";
declare option output:html-version  "5.0";

<html><body><area/><base/><br/><col/><command/><embed/><hr/><img/><input/><keygen/><link/><meta/><param/><source/><track/><wbr/></body></html>
]]></test>
      <result>
         <all-of>
           <serialization-matches><![CDATA[<html><body><area\s*/><base\s*/><br\s*/><col\s*/><command\s*/><embed\s*/><hr\s*/><img\s*/><input\s*/><keygen\s*/><link\s*/><meta\s*/><param\s*/><source\s*/><track\s*/><wbr\s*/></body></html>]]></serialization-matches>
           <serialization-matches flags="i"><![CDATA[<!DOCTYPE .*]]></serialization-matches>
         </all-of>
      </result>
   </test-case>

"command" is not an EMPTY/void.

[Definition: The following XHTML elements have an EMPTY content model: area, base, br, col, embed, hr, img, input, link, meta, basefont, frame, isindex, and param.]

[Definition: The void elements of HTML5 are area, base, br, col, embed, hr, img, input, keygen, link, meta, param, source, track and wbr.]
Comment 6 O'Neil Delpratt 2015-06-24 12:14:41 UTC
Test case fixed by removing the <command/> element from the test case.
Comment 7 Tim Mills 2015-06-24 13:55:25 UTC
Confirmed fixed.  Thanks.