Re: Odd case sensitive rules regarding <A name="abc">

Chris Maden (
Wed, 18 Feb 1998 10:17:19 -0500

Date: Wed, 18 Feb 1998 10:17:19 -0500
Message-Id: <>
From: Chris Maden <>
In-reply-to: <000401bd3bee$0f40c480$cf20268a@hpxu> (message from Ian Hickson
Subject: Re: Odd case sensitive rules regarding <A name="abc">

[Ian Hickson]
> From the HTML4 spec: [1]
> > Section 12.2.1  Syntax of anchor names
> > An anchor name is the value of either the name or id attribute
> > when used in the context of anchors. Anchor names must observe the
> > following rules:
> > * Uniqueness: Anchor names must be unique within a document.
> >   Anchor names that differ only in case may not appear in the same
> >   document
> > * String matching: Comparisons between fragment identifiers and
> >   anchor names must be done by exact (case-sensitive) match.
> So the following code is illegal:
> ----------------
> <P ID=ONE>...
> <P ID=one>...
> <P> <A HREF="ONE">Link to first paragraph</A>
> <P> <A HREF="one">Link to second paragraph</A>
> ----------------

This code *must* be illegal by SGML rules.  IDs are case sensitive in
the same manner as element names; since HTML has decided that <p>
should equal <P>, id="one" must match id="ONE".

> Yet the following code should do nothing:
> ----------------
> <P ID=one>...
> <P> <A HREF="ONE">Link to the paragraph</A>
> ----------------
> Why???

The above is not true for HREFs, since the HREF attribute is declared
as CDATA, which preserves case.[1]  However, the above *would* work in
a conforming SGML application, so the HTML spec really can't outlaw
it; an application shouldn't be able to tell the difference between <p
id="one"> and <p id="ONE">.

XML, BTW, is completely case-sensitive in all areas, so there's no
ambiguity or confusion like this.


[1] Assuming for this discussion that you meant <A HREF="#ONE">.
<!ENTITY crism PUBLIC "-//O'Reilly//NONSGML Christopher R. Maden//EN"
"<URL> <TEL>+1.617.499.7487
<USMAIL>90 Sherman Street, Cambridge, MA 02140 USA" NDATA SGML.Geek>