Knitr XHTML won't render in browser when MIME is XHTML - r

The header of a Knitr generated HTML file states the resulting document is XHTML-compliant:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
However, if the MIME type is reported as XHTML to IE/Chrome/Firefox browsers it will not render due to XML errors. Easily confirmed by changing the extension of a generated file to xhtml and opening directly in a browser.
Normally this isn't an issue as the extension is set to html. But we have automated processes on our servers to generate knitr files and autodetect the MIME type by examining the file and checking whether it claims to be XHTML, then set the MIME accordingly. Which causes the knitr files to fail to render in browsers for the reasons stated above.
How can I drop the xmlns attribute from knitr generated files?

Related

Magento CSS property background-image:url issue with data:image/svg+xml;base64

Magento page rendering forces the ccs property background-image:url() to add the domain and directories from the root for values that are base 64 encoded images. For example background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxu....)
will be rendered
background-image:url(http://domain.com/path-to-css/data:image/svg+xml;base64,PHN2ZyB4bWxu....).
I am looking for a CSS switch/setting that forces the application to recognize it is encoded data instead of a URL requiring relative completion. This generates a 404 error for the non existent image and never renders the encoded image.
It is a bug in Magento css and js combine, minifier.
If you turn css combine off, it will work perfectly.
How to turn on/off:
http://www.metacdn.com/speed-up-magento/combine-and-minify-js-css
This is related to the doc type. base64 images work in html 5 doc types, i.e. !DOCTYPE html . My magneto current configuration !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" .

Influencing the encoding for pages served by meteor?

How can I set a encoding for my pages served with meteor? Currently my Firefox keeps on outputting this warning:
The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must to be declared in the document or in the transfer protocol.
Just set your encoding inside any <head> section of a html file:
<head>
<meta charset="UTF-8">
<title>Whatever</title>
</head>
From Meteor's documentation:
HTML files in a Meteor application are treated quite a bit differently
from a server-side framework. Meteor scans all the HTML files in your
directory for three top-level elements: <head>, <body>, and
<template>. The head and body sections are separately concatenated
into a single head and body, which are transmitted to the client on
initial page load.

XHTML & CKEditor question

Does CKEditor output data xhtml compliant?
Probably not.
Try running the output through something like HTMLPurifier.
http://htmlpurifier.org/
Added bonus of clean content, especially if user generated.
CKEditor is itself not XHTML compliant, and can not be served on an XHTML page (with the XHTML mime type application/xhtml+xml)
https://dev.ckeditor.com/ticket/2807
https://dev.ckeditor.com/ticket/4576
https://dev.ckeditor.com/ticket/7849

Is it possible to pass w3 xhtml strict validation and still use google analytic code on my webpage?

Is it possible to pass w3 xhtml strict validation and still use google analytic code on my webpage?
Yes. If the specific code were to contain an &, >, or < (it doesn't), you would have to wrap the JavaScript in <script type="text/javascript">//<![CDATA[ and //]]></script> (ampersands are normally reserved for XML entities, and the others are for tags).
If you serve your web page using the XHTML MIME type application/xhtml+xml rather than the default HTML MIME type text/html, problems may result then. Serving pages under the latter MIME type only causes reduced cross-browser compatibilty and prevents many scripts from working. Though in the long term, I would focus on HTML5 compliance rather than XHTML compliance – that's the way further development of web standards is heading.

Eclipse BIRT - XHTML output

Is there a way to set BIRT to output a report as XHTML (1.0 Transitional would be fine) instead of HTML?
I did a few tests and there are some elements that are not valid:head does not include a title, html must have a namespace (xmlns) attribute
Is this functionality supported at all by BIRT?
----- EDIT -----
Here are the current changes I need to make on the current HTML output produced by BIRT:
Change the doctype to xhtml transitional
Add the xmlns attribute to the html tag
Add the title element in the <head>
Set the missing end tag to the meta tag(s): </meta>
If the functionality is not supported by BIRT, how can I extend the current HTML emitter to transform the current HTML output to valid XHTML?
This is not one of the standard output formats. You should be able to extend the HTML emitter with little effort to do this yourself.
Here are some resources to get started extending BIRT:
Writing a BIRT Extension
Tutorial
Writing a custom emitter (XML in
this case)
Good Luck!

Resources