Guidelines for Using HTML-Based Output Templates with HTTP Clients
If you want to use an HTML-based output template to return output to an HTTP client, keep the following points in mind:
Make sure the output template produces a valid HTML document.
If the client checks the Content-Type value in the HTTP response header, make sure the template contains a <meta> tag that sets the Content Type to “text/html”.