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.

-Chris

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

Received on Wednesday, 18 February 1998 10:11:42 UTC