Re: [xsl] Understanding why <tag></tag> is the way it is (was Re: [xsl] IE Client side transformation issue)

Subject: Re: [xsl] Understanding why <tag></tag> is the way it is (was Re: [xsl] IE Client side transformation issue)
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Fri, 03 Aug 2007 18:38:27 +0200
David Carlisle wrote:
Isn't this part of the HTML spec? I realize that its a bit silly that not using a closing script element breaks the page

that's what the HTML spec would demand, so this behaviour doesn't seem silly to me. remember in html script is a CDATA eleemnt so it turns off < and & as being special characters and normal processing only begins after the literal string </script appears. So ypu can't omit the end tag.

I should not mention HTML when I mean XHTML, sorry for the confusion.


This is rather interesting, because in XHTML <script> has become a PCDATA element. Which means, IIRC, that < and & should be escaped. Which is why in XHTML it is recommended to put the data of a script tag into a <[CDATA[ section, so you don't have to worry too much about all these escaping. In XSLT you can do this by setting the xsl:output attribute of cdata-section-elements to "script".

Cheers,
-- Abel Braaksma

Current Thread