RE: CDATA in attribute values

Christian Smith <> wrote:
> On Wednesday, December 6, 2000 at 19:30, (Dave  J
> Woolley) wrote:
>> 	[DJW:]  No.
>> 	Naked &'s and <'s are not permitted in attribute
>> 	values, and XML directives are definitely not
>> 	recognized in that context.
>> 	See 
>> 	<>,
>> 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.
> Ok, but how does this jive with the definition of CDATA sections:
>	 2.7 CDATA Sections
>	 [Definition:] CDATA sections may occur anywhere
>	 character data may occur; they are used to escape
>	 blocks of text containing characters which would
>	 otherwise be recognized as markup. CDATA sections
>	 begin with the string "<![CDATA[" and end with the
>	 string "]]>":
> I realize that using this in an XHTML document would create something
> not supported by the validator or by a current HTML renderer, but is it
> valid XML to use a CDATA section in an attribute value if that attribute
> is defined as having a content model of CDATA?
> -- 
> Christian Smith  |  |
> He who dies with the most friends... Is still dead!

Joe English has a useful document entitled "CDATA Confusion", which may be
relevant here.

I think section 2 provides the answer.



Received on Thursday, 7 December 2000 06:34:06 UTC