Click here to get back home

Doctypes, validity etc.

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Doctypes, validity etc. Andy Dingley 11-14-2006
Posted by Andy Dingley on November 14, 2006, 9:26 am
Please log in for more thread options


Here's a chunk of a longer piece of punditry I'm working on, re: the
choices between doctypes for authoring and the State of the Union for
validity. I've got a bucketload of nasty code and a bunch of developers
who need education on validation, validity and all the usual good
stuff. In particular it's a problem of triage on the legacy code:
what's correctable now, what's going to need serious work, what's going
to be a total re-write.

I'd appreciate any comments you might have


Levels of Validity

Formally there are no "levels of validity". Validity is objective and a
document is either valid or not. For authoring we should keep to this
view. For assessing legacy documents though, it is useful to invent
some "levels" of validity. Remember that these are an arbitrary
invention with no formal definition and no standard comparability with
other projects or W3C recommendations. Validity can only be defined in
terms of a specific doctype, so these are defined against Strict.

Trivial invalidity

Use of the <a target="..." > attribute. These would be valid
Transitional documents.

Documents are known to render exactly like valid Strict documents .

Minor invalidity

Inline elements placed directly into <body> or <form> elements. Use of
<font> tags. These would be valid Transitional documents.

Documents are known to render like valid Strict documents, because
browsers(sic) compensate(sic) automatically(sic) for these
"well-known"(sic) invalidities.

Major invalidity

Documents that are not even valid as Transitional. Typically this is
caused by improper nesting or closure of elements.

Rendering of these documents relies on SGML parsing producing a correct
DOM of the document elements. This is not a reliable authoring process:
although the SGML behaviour is deterministic, the effects are not
human-friendly and may give quite different elements from the tags that
the author used (particularly for invalid nestings).

It's even possible that "valid" legacy documents should be treated as
being majorly invalid. Where authors have mis-used the element closure
rules, the SGML behaviour is still clear for how this translates to the
DOM elements, but it may not be what the author expected. It's
difficult to identify these valid but incorrect documents, or to tell
some majorly and grossly invalid documents apart, without having
knowledge of what the author originally intended. This is why
automatic-correction of these afterwards is always a hard problem [12].

Grossly invalid

Tag-soup documents that barely resemble the DTD. These are still the
most common legacy documents.

Element set

There are massive advantages to abandoning "HTML 3.2" style layout with
its plethora of <font> tags, <table> used for layout and even the
single-pixel gif. These advantages come about by using the right
elements and ignoring the bogus ones though, not by any magic choice of
doctype.

Although it's true that using a Strict doctype will force you to do
this, it's just as easy to do so with a Transitional doctype. You can
write just as good markup under Transitional as you can under Strict,
it doesn't _require_ you to use <font> or to misuse <blockquote> for
indents.

Don't be afraid of Transitional. It's just as "good" as Strict, so
long as you aren't actually using any of the undesirable elements.
Equally, if you aren't using them then you could use the Strict
doctype. However, if the page is valid as Transitional but not as
Strict, then treating it as Transitional would allow the simple
objective validity test to be passed.

Transitional Differences

Transitional represents the shift in design philosophy from HTML 3.2 to
HTML 4.0 and CSS. The concept behind the two doctypes is that older
HTML 3.2 documents may simply be re labelled as HTML 4.01 Transitional
and that all new documents will be authored as HTML 4.01 Strict.
Transitional was only ever a temporary transitional phase and that was
7 years ago!

Legacy documents

We must accept that we have legacy documents, and that they'll be in
less than ideal form.
Legacy documents should be treated as invalid HTML 4.01 Strict
documents and should have an appropriate doctype declaration added
immediately. Then work on refactoring their validity, where possible.
It's better to do this than to leave them under the old doctypes: even
having valid HTML 3.2 wouldn't be a valuable distinction.

There will be many problems with legacy documents. They're likely to be
invalid, to use a poor set of elements and even to be not well-formed.
The difficulty of bringing them up to a "best practice" standard
depends on how bad particular examples are. Practically, well
formedness should be rapidly achievable, element use and validity may
be impractical to change.

In the rare case of almost-correct legacy documents (trivial or minor
invalidity, as described above), there could be a benefit to using a
Transitional doctype (see the discussion for new work). Otherwise it's
always best to label them as 4.01 Strict and at least gain the CSS
rendering benefits from it, rather than to label them as something
obscure albeit valid under that description. The web (as a consumer of
HTML, rather than an authoring problem) cares less about doctypes than
it does about content.


Posted by Stephen Poley on November 14, 2006, 3:00 pm
Please log in for more thread options


wrote:

>I'd appreciate any comments you might have

These two bits seem to be contradictory:

>Don't be afraid of Transitional.
...
>We must accept that we have legacy documents, and that they'll be in
>less than ideal form.
>Legacy documents should be treated as invalid HTML 4.01 Strict
>documents

Why not treat legacy docs as Transitional? That's what it's there for.

And then:

>It's just as "good" as Strict, so
>long as you aren't actually using any of the undesirable elements.

But in that case there's no point in using Transitional. The thing about
Transitional is that it gives you a means of getting pages into a
reasonably sane state without having to go in for complete rewrites.

This is the key point, which should probably be placed earlier in the
piece:

>The concept behind the two doctypes is that older
>HTML 3.2 documents may simply be re labelled as HTML 4.01 Transitional
>and that all new documents will be authored as HTML 4.01 Strict.

I would suggest that if old documents are anywhere remotely near to
valid HTML 4.01 Transitional then you should make them valid
Transitional and not for the moment put any effort into making them
valid Strict.

Use Strict for new pages. Prioritise rewriting of old pages, giving
priority points to pages which are:
1) much visited;
2) frequently edited;
3) have really messy markup.

And when rewriting legacy pages, make no attempt to re-use any markup.
It just isn't worth it. Save the page as text, rescue the images and
start from scratch with the HTML and CSS. (I've done it once myself.)

>Transitional was only ever a temporary transitional phase and that was
>7 years ago!

It's probably best to view Transitional in terms of page update
transitions rather than years. If one only gets around to updating a
1997 site in 2010 it might still be best to start by pushing the old
pages into (more-or-less) valid Transitional. They might then last a few
years more until you complete the rewrite ...

HTH

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/

Posted by Thomas Mlynarczyk on November 14, 2006, 4:17 pm
Please log in for more thread options


Also sprach Stephen Poley:

> (more-or-less) valid Transitional.

like (more-or-less) pregnant?

SCNR,
Thomas



Posted by Andy Dingley on November 14, 2006, 4:35 pm
Please log in for more thread options



Stephen Poley wrote:
> wrote:

> Why not treat legacy docs as Transitional? That's what it's there for.

The problem is whether it's better to treat legacy documents as
Transitional or Strict.

My argument is that in nearly all practical cases, it's better to label
them as Strict and then proceed from there on. Only in a very narrow
set of cases is there any benefit from labelling them as Transitional.
Overall it's simpler and just as practially useful to label _all_ as
Strict consistently, rather than trying to make an awkward judgement
call on each one.

The documents in question are probably no better treated as
Transitional than as Strict, i.e. they're poorly authored, not just
authored well to an old standard.


Posted by Stephen Poley on November 15, 2006, 12:33 pm
Please log in for more thread options


wrote:

>Stephen Poley wrote:
>> wrote:
>
>> Why not treat legacy docs as Transitional? That's what it's there for.
>
>The problem is whether it's better to treat legacy documents as
>Transitional or Strict.
>
>My argument is that in nearly all practical cases, it's better to label
>them as Strict and then proceed from there on. Only in a very narrow
>set of cases is there any benefit from labelling them as Transitional.
>Overall it's simpler and just as practially useful to label _all_ as
>Strict consistently, rather than trying to make an awkward judgement
>call on each one.

I'm not suggesting making a judgement call on each one. I'm suggesting
labelling them all Transitional and only using Strict for new pages /
complete rewrites.

It isn't really an issue though as to what you *label* them. But if you
have the choice between making a dozen changes to produce a valid
Transitional document, or a hundred changes to produce a valid Strict
document, it's an easy choice ...

>The documents in question are probably no better treated as
>Transitional than as Strict, i.e. they're poorly authored, not just
>authored well to an old standard.

... on the other hand, if they are really a complete mess, why put a
DOCTYPE on at all? I'd suggest leaving well alone until you can replace
them completely, as even adding a DOCTYPE might produce undesirable
side-effects in some browser.

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/

Similar ThreadsPosted
Problem with xhtml 1.1 and validity May 3, 2005, 6:32 pm
Problems with DOCTYPES April 1, 2005, 11:22 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap