RE: [xsl] <textarea>, HTML and CDATA

Subject: RE: [xsl] <textarea>, HTML and CDATA
From: "Passin, Tom" <tpassin@xxxxxxxxxxxx>
Date: Tue, 4 Feb 2003 10:24:51 -0500
[Mike Brown]

> Well, creating the result that you're asking for is easy...
> 
> <xsl:template match="codebox">
>   <form>
>     <textarea rows="5" columns="50">
>       <xsl:copy-of select="."/>
>     </textarea>
>   </form>
> </xsl:template>
> 
> ... but it is also incorrect. 

... Because the HTML Rec specified that a textarea element may only
contain PCDATA.

Furthermore, if you try to trick the textarea by writing a
<![CDATA[...]]> string into it (say if you were dong it using
javascript), IE and Mozilla handle it differently.  IE displays what you
would expect (the contents without the <![CDATA[]]> envelope, but Moz
displays something broken like [CDATA[...]].

So even if you were willing, you could not be sure what the result would
be.

Cheers,

Tom P

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread