[WEB4LIB] coding for both HTML 4.01 and xhtml transitional

Kevin W. Bishop bishopk at rpi.edu
Mon Sep 9 15:26:10 EDT 2002

At 08:33 AM 9/8/2002 -0700, JQ Johnson wrote:
>I have a project for which I am attempting to generate code that
>validates both as HTML 4.01 Transitional and as xhtml 1.0 Transitional.
>I'm having difficulty, and wondered if anyone else has suggestions.

In my understanding, it is not possible to define your document as two 
different types.  A DTD can only claim to be of one type or 
another.  Otherwise, how will the browser choose which set of rules its 
rendering engine will use?

>(note:  "why bother?", you may ask.  The specific application is a
>server-side include file that contains standardized header elements.
>We'd like our library authors to be able to use the SSI for all
>documents on our site and have the resulting URLs validate, whether they
>have legacy HTML 4.01 code or spiffy up-to-the-minute xhtml.)

This is an interesting idea -- multiple DTD's -- but your problem seems 
more at content management.  If you're worried about library authors not 
having the expertise or discipline to author well-formed XHTML, I might 
suggest that aiming toward a transitional (tolerant?) version of HTML 
(probably 4.01?).

>Related question:  apart from formal validation, does *anything* in any
>existing browser break if you claim to be HTML 4.01 Transitional but
>include the trailing "/" in link tags?
>If you don't have an answer to my specific questions, here's another
>one:  what is it about the DTD for HTML 4.01 Transitional that allows
>trailing slashes on most empty tags, but not on header tags such as LINK
>or META?  That is, why is
>     <br />
>valid HTML 4.01 but
>     <link rel="stylesheet" type="text/css" href="style.css" />

You sort of answered your own question.  Sort of.  Obviously, not 
everything breaks when declaring HTML 4.01 Transitional and writing XHTML 
w/in the document, but the link tag does.  Are you referring to breakage as 
in a rendering within a specific browser or as reported errors when 
validating the code?


Kevin W. Bishop   >   bishopk at rpi.edu
Communication & Collaboration Technologies
Rensselaer Polytechnic Institute
      RPInfo: http://www.rpi.edu/rpinfo/
      Kiosk: http://j2ee.rpi.edu:8080/kiosk/setup.do

More information about the Web4lib mailing list