Re: Need chapter and verse on quoting of attribute values

Joe English (
Wed, 14 May 1997 18:52:00 PDT

Message-Id: <>
Subject: Re: Need chapter and verse on quoting of attribute values
In-Reply-To: <v03010d0faf9ff30c7c41@[]>
Date: Wed, 14 May 1997 18:52:00 PDT
From: Joe English <>

Jennifer Masek <jmasek@SLAC.Stanford.EDU> wrote:

> 1)
> The 3.2 spec states:
> >
> HTML allows CDATA attributes to be unquoted provided the attribute value

[ The HTML 3.2 recommendation departs slightly from SGML here.
  In SGML, and in RFC1866, the syntax of attribute value specifications
  is the same for _all_ declared value types, not just CDATA. ]

> contains only letters (a to z and A to Z), digits (0 to 9), hyphens (ASCII
> decimal 45) or, periods (ASCII decimal 46).  Attribute values can be quoted
> using double or single quote marks (ASCII decimal 34 and 39 respectively).
> Single quote marks can be included within the attribute value when the
> value is delimited by double quote marks, and vice versa.
> >
> Does this mean that if an attribute value contains a "/" or a "#" that it
> must, under the 3.2 specification, be quoted?

Yes.  This is the case for any SGML document type, not just HTML.

> 2)
> I cannot find an equivalent statement in the RFC 1866, though I am told
> that there is one that governs the quoting of attribute values for HTML
> 2.0 compliance.

See section 3.2.4. "Attributes".

| 3.2.4. Attributes
|    [...] An attribute specification typically consists of an attribute
|    name, an equal sign, and a value [...]
|    The value of the attribute may be either:
|         * A string literal, delimited by single quotes or double
|         quotes and not containing any occurrences of the delimiting
|         character.
|         * A name token (a sequence of letters, digits, periods, or
|         hyphens). Name tokens are not case sensitive.

[ Here RFC 1866 departs slightly from SGML.  In SGML case sensitivity
  is determined by the attribute's declared value, not by the form
  of the attribute value specification.  Or perhaps I'm misinterpreting
  this part of the spec.  ]

|    Attributes such as ISMAP and COMPACT may be written using a minimized
|    syntax (see "Omitted Attribute Name" in [SGML]).

--Joe English