This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
XSLT spec says: "The html output method should not output an element differently from the xml output method unless the expanded-name of the element has a null namespace URI" Since all HTML elements are in XHTML namespace, this means that <br> must be output as <br></br>, which is of course not what we want in html output. There is already a related intentional violation of XSLT in HTML, but my understanding is that it only makes things worse in this regard. References: https://bugs.webkit.org/show_bug.cgi?id=76707 https://bugzilla.gnome.org/show_bug.cgi?id=651925 http://www.w3.org/TR/xslt/#section-HTML-Output-Method http://www.w3.org/TR/html5/interactions-with-xpath-and-xslt.html#interactions-with-xpath-and-xslt
Not just <br>, presumably; any void element.
Would a pragmatic approach be to apply this part of the XSLT spec[1]: "The html output method should not output an end-tag for empty elements. For HTML 4.0, the empty elements are area, base, basefont, br, col, frame, hr, img, input, isindex, link, meta and param. For example, an element written as <br/> or <br></br> in the stylesheet should be output as <br>." ...but also apply it to (X)HTML namespaces (or indeed, any namespace?). For example, an element with a non-null namespace, with a local-name of "br" must be output as XML (per the spec), but there's nothing preventing the above rule also being applied, resulting in the output as <br/>. [1] http://www.w3.org/TR/xslt#section-HTML-Output-Method
The XSLT "html" output method is inappropriate for today's HTML for more reasons than void elements. If you're going to fix it, why not fix it properly? Also see http://about.validator.nu/apidoc/nu/validator/htmlparser/tools/XSLT4HTML5.html
IIRC, the XSLT WG was making fixing the html output method or creating a new HTML5-aware output method.
So what's the requested fix to the HTML spec here?
Some things to consider: Void elements. SVG and MathML and namespaced attributes. RCDATA elements. RAWTEXT elements. CDATA sections? script elements. Nice to have: Ability to output the short doctype without using "emit these characters here" feature (which doesn't work in impls that transform the DOM directly instead of serialize then parse). Namespace declarations. Elements in no namespace (I think should end up in the HTML namespace?) <pre>\n (and textarea and listing)
Are these things to consider for changes to XSLT, or HTML?
I'm at a loss as to what is being requested here.
Upon further discussion, I think the best course of action here would be for the HTML spec to remove its monkeypatching of XSLT, and let the XSLT spec just be updated to work with modern text/html, if there is still interest in doing that.
The thing is that there does not appear to be interest in speccing revisions to XSLT 1.0 and there does not appear to be browser interest in implementing later versions of XSLT. Hence, the need to spec a delta from XSLT 1.0 somewhere.
Anyone interested in writing a spec that defines that?
I don't have the XSLT domain knowledge for this, so I don't know how to proceed. The HTML spec has some normative and some non-normative comments about how to fix XSLT, but I don't really understand them. I'm happy to add more, or make the non-normative text normative if it can be made comprehensive, but I don't think it's worth my time to learn XSLT to do this, since XSLT doesn't seem to be the future. I'm moving this to the "Unwelcome" component; please feel free to reassign it to me if you have text for me to write (or very specific instructions about what the text should say; I don't mind writing it if someone can tell me what it should say and work with me to get it to a good state.)
See bug 17976.
I think that this bug can be actually closed. Problem reported for serialization of <br> can be easily solved: a) In XSLT 1.0 use HTML output method and write stylesheets in a way that HTML elements are not in any namespace. b) In XSLT 2.0 use either a) or use XHTML output method and write stylesheets that emit HTML elements in http://www.w3.org/1999/xhtml namespace 3) In XSLT 3.0 there is a new serialization method which should be fully "HTML5-aware": http://www.w3.org/TR/xslt-xquery-serialization-30/#html-output If there is anything missing or wrong in the XSLT 3.0 HTML serialization please report it to address in the document, XSLT WG would be happy to fix it. Jirka