W3C home > Mailing lists > Public > www-validator@w3.org > September 2003

Re: Custom DTD for case-insensitive ID values ?

From: Jukka K. Korpela <jkorpela@cs.tut.fi>
Date: Sun, 14 Sep 2003 20:06:43 +0300 (EEST)
To: www-validator@w3.org
Message-ID: <Pine.GSO.4.58.0309141956060.114@korppi.cs.tut.fi>

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 25 April 2012 12:14:09 GMT