RESTXQ: wrong doctype with xhtml method
Monday, 27 July 2015 · 2 messages · last reply 28 Jul 2015
MG
Maximilian Gärber27 Jul 2015 12:21 #
Hi,
when using 'xhtml' output method, the doctype always matches the name of the root element (instead of 'html').
Does not happen with 'html' output method.
-- start xqm --
declare
%rest:GET
%rest:path("test-frag")
%output:method("xhtml")
%output:html-version("5.0")
function _:test-frag(){
<form>
</form>};
-- end xqm --
Result:
<!DOCTYPE form>
<form></form>Regards,
Max
CG
Christian Grün28 Jul 2015 13:16 #
Hi Max,
Quoted text · Maximilian Gärber · 4 lines
> when using 'xhtml' output method, the doctype always matches the name > of the root element (instead of 'html'). > > Does not happen with 'html' output method.
It may come as a surprise (and I cannot give an explanation for that), but the current behavior is in compliance with the serialization spec:
• XHTML: "The name following <!DOCTYPE MUST be the same as the local part of the name of the element." [1]
• HTML: "The name following <!DOCTYPE MUST be HTML or html." [2]
Cheers,
Christian
[1] http://www.w3.org/TR/xslt-xquery-serialization-31/#XHTML_DOCTYPE [2] http://www.w3.org/TR/xslt-xquery-serialization-31/#HTML_DOCTYPE
Written for BaseX 8.2. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery