tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Preißer <>
Subject RE: Documentation Question
Date Tue, 21 Feb 2012 22:49:33 GMT
Hello Christopher,

> -----Original Message-----
> From: Christopher Schultz []
> Sent: Tuesday, February 21, 2012 10:35 PM
> To: Tomcat Users List
> Subject: Re: Documentation Question
> Many (all?) XSLT processors will emit <p /> (for example) if there is
> no content in a <p></p> pair. I know that definitely doesn't work in
> many (all?) web browsers, even in XHTML mode.

It does work, but only if you deliver the content in XHTML mode, that is, using a Content-Type
of "application/xhtml+xml" (because then the browsers use their strict XML parser). Otherwise,
when it is delivered as "text/html", Browsers will always use their HTML parser, even if you
use a Doctype that declares the document as XHTML.
On a local Windows and Linux filesystem, if you save the file as .html, it will be treated
by browsers as HTML, whereas if you save it as .xhtml, it will be treated as XHTML.

For example, if you use the following XHTML document:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns=""><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<style type="text/css">
p { background-color: #F66; height: 50px; }
Text <p/> Text2

If you save this file as .xhtml on your filesystem and open it, the Browser will render the
page correctly (the red <p> is between Text1 and Text2). At least it works with IE 9
(IE <= IE8 don't support XHTML), Firefox, Chrome and Opera. ;-)

Konstantin Preißer

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message