David Schwartz wrote:
Quote:
I'm outputing HTML (and Javascript), not XML.
cdata-section-elements appears to be appropriate only where
method=xml. Perhaps I'm missing something?
|
Yes, <xsl:output cdata-section-elements="code"/was what I intended.
Some references (including Michael Kay's book, which is one of the best
hardcopy references I've seen for XSLT) do claim that
cdata-section-elements is marked as "not applicable to html output".
However, I've just rechecked and I don't see that restriction in the
XSLT Recommendation itself. All I can say is "try it, and if it doesn't
work ask the processor's authors why not."
But: No program ought to care whether you've used CDATA sections or
individual-character escaping; that distinction is purely a convenience
for humans. Any program which *insists* on one representation or the
other is not processing the documents as intended by their spec. There
are a few special cases where CDATA sections are worth considering --
mostly when the document source is intended to be hand-edited by humans
-- but even there I consider them excessively fragile. So I would also
beat up whoever wrote the code that is foisting this requirement upon you.