W3C home > Mailing lists > Public > www-html@w3.org > December 2000

RE: CDATA in attribute values

From: Dave J Woolley <david.woolley@bts.co.uk>
Date: Wed, 6 Dec 2000 19:30:06 -0000
Message-ID: <81E4A2BC03CED111845100104B62AFB5824C3B@stagecoach.bts.co.uk>
To: "'www-html@w3.org'" <www-html@w3.org>
> From:	Christian Smith [SMTP:csmith@barebones.com]
> 
> I this valid?
> 
> <img src="foo.gif" alt="<![CDATA[ Jack & Jill ]]>" />
> 
	[DJW:]  No.

	Naked &'s and <'s are not permitted in attribute
	values, and XML directives are definitely not
	recognized in that context.

	See 
	<http://www.w3.org/TR/2000/REC-xml-20001006#sec-common-syn>,
production number [10].

	Whilst it is just conceivable that some version of XHTML
	has extended ALT to allow it to include XML text for
	recursive expansion, such a change would not be understood
	by a general validator, because it requires knowledge beyond
	the content of the DTD, and would not be backwards compatible,
	because of the need to double escape < when one doesn't
	want interpreted as the start of a tag.

	The comment that someone made about the validator is probably
	referring to the fact that it fails to fault the use of
	< in the value; a rule that is probably in there to allow
	rapid error recovery.  As far as I know, an SGML parser
	(e.g. one for HTML) should not recover from an unclosed 
	quote on seeing a new tag.  The validator is based on an
	SGML validator, and may well not account for this subtlety.


-- 
--------------------------- DISCLAIMER ---------------------------------
Any views expressed in this message are those of the individual sender,
except where the sender specifically states them to be the views of BTS.
Received on Wednesday, 6 December 2000 14:30:12 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:15:44 GMT