Yes, definitely. This and similar questions have been
coming up very frequently on www-talk and c.i.www.*
recently.
Some items that should be clarified:
* Are quotes always allowed around attribute values?
[ Yes. ]
* Are quotes ever *necessary* around attribute values?
[ Only if the specified value is not a name token.
E.g., <A HREF=next-page> is OK, but <A HREF=http://...>
is not.
The attribute's declared value (NAME, ID, CDATA, etc.)
in the DTD doesn't matter in this context. ]
* Can attribute value literals contain entity references?
(<IMG ALT="A < B">)
[ Yes, and they should be expanded. ]
* But the XXX attribute is declared as CDATA in
the DTD. Doesn't that mean that entities aren't allowed?
[ No. CDATA in this context just says that the *value*
may be any character data (as opposed to name tokens
or IDs). Attribute value literals are always *parsed*
as replaceable character data. ]
* Can attribute values contain other HTML elements?
(<IMG ALT="<HR>")
[ No. Well, <IMG ALT="<HR>"> is legal, but the alternate
text will be the literal text <HR>, not a horizontal
rule. ]
* What's the difference between <A HREF='...'> and
<A HREF="...">?
[ None, except that " can appear in the value if you use '...'
but not if you use "...", and conversely.
If you need both ' and ", you can use character
references "Single: ', double: "" ]
--Joe English
joe@trystero.art.com