HTML output method, <script> element

Question arising from a user's bug report:

If you write

<xsl:output method="html"/>
<xsl:template match="/">
<script>
   write("<b> if (a &lt; b) </b>");
</script>
</xsl:template>

should the output be (a)

<script>
  write("<b> if (a < b) </b>")
</script>

or (b)

<script>
  write("<b> if (a &lt; b) </b>")
</script>

(Saxon's output is a muddled mixture of the two and it needs to be changed
to one or the other)

The spec says ".. should not perform escaping for the content of the script
.. element", which I think implies (a); but (b) seems more useful.

I told the user he should really be writing it as

<xsl:template match="/">
<script><![CDATA[
   write("<b> if (a < b) </b>");
]]></script>
</xsl:template>

but that doesn't really answer the question.

Mike Kay

Received on Friday, 2 February 2001 17:44:30 UTC