xsl-list
[Top] [All Lists]

RE: <textarea>, HTML and CDATA

2003-02-04 08:24:51
[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



<Prev in Thread] Current Thread [Next in Thread>