Re: Custom DTD for case-insensitive ID values ?

On Sun, 14 Sep 2003, Philip TAYLOR [PC336/H-XP] wrote:

> Dear Colleagues -- Working on a new site, I have reached the
> stage where the site validates successfully /except/ for one
> area : the validator points out that my IDs are not unique,
> because I am differentiating pairs on the basis solely of case.
> Having read the background information, I can see no reason
> why this should matter,

Then you haven't read enough. You cannot rely on browsers distinguishing
between anchors that differ in case only, and the results are thus
unpredictable. Isn't it much simpler, and far more robust, to just rename
the anchors as needed?

> and I would therefore like to create
> a custom DTD which allows IDs to be distinguishable only by
> case.

Well, that is possible, but I really don't think you should do that.
Anyway, it can be done by location the following in the DTD:

<!ENTITY % coreattrs
 "id          ID           #IMPLIED  -- document-wide unique id --

and changing ID (the uppercase string) to NAME. You could alternatively
use CDATA, but that would be more permissive than you asked for.
The syntactic rule for NAME values is the same as for ID values, but for
ID, there is the added requirement of uniqueness.

Interestingly, the W3C "markup validator" then says that
"This page is not Valid HTML 4.01 Transitional!"
(something I really did not ask it to check)
and then
"Below are the results of attempting to parse this document with an SGML
parser."
followed by a source listing. I know that this is its odd way of telling
that the page validates, but I'm afraid novices will be thoroughly
confused.

-- 
Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/

Received on Sunday, 14 September 2003 13:06:45 UTC