tomcat-users mailing list archives

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

> -----Original Message-----
> From: Christopher Schultz [mailto:chris@christopherschultz.net]
> 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" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Testpage</title>
<style type="text/css">
p { background-color: #F66; height: 50px; }
</style>
</head><body>
Text <p/> Text2
</body></html>

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. ;-)


Regards,
Konstantin Preißer


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message