Re: GOTCHA!

Subject: Re: GOTCHA!
From: "Oren Ben-Kiki" <oren@xxxxxxxxxxxxx>
Date: Thu, 14 Jan 1999 19:00:58 +0200
James Clark <jjc@xxxxxxxxxx> wrote:

>Oren Ben-Kiki wrote:
>> I would write:
>>
>> <script>//<xsl:cdata>
>> for(i = 10; i >= 0; i--) {
>> }
>> //</xsl:cdata></script>
>
>And get
>
><script>//<![CDATA[
>for(i = 10; i >= 0; i--) {
>}
>//]]></script>
>
>Seems like a hack to me.  It does avoid the problem of -- not being
>allowed inside comments, but there's already a hack you can use to avoid
>that problem, which is to use a PI:
>
><script>//<xsl:pi name="xyzzy">
>for(i = 10; i >= 0; i--) {
>}
>//</xsl:pi></script>


Now this is a hack! You stepped on another XT bug here - or a specs bug. I
checked the following:

<xsl:template match="A">
<xsl:pi name="JavaScript">
 <xsl:text><![CDATA[<&>]]></xsl:text></xsl:pi>
</xsl:template>

And got in the result:

<?JavaScript <&>>

Whish is anything but valid XML. Note that if you fix this problem in XT -
somehow - you'll ruin the usefulness of your solution, while mine always
emits valid XML and given reasonable treatment of ']]>' - conversion to ']]
>', say - will always emit valid JavaScript code as well.

>None of this is really necessary.  For HTML 4.0 you can use result-ns,

I could be missing something here since I'm doing my best to avoid
namespaces :-) but don't they just deal with XML issues?
Or could I expect that an XML/XSL processor to be smart enough to use
different character quoting rules within a <SCRIPT> tag? It would also have
to examine the LANGUAGE attribute for it... I'd be very surprised if this
works - it certainly doesn't in XT.


>and in the future, with Voyager, the whole problem goes away.

"In the long run, we are all dead". I'm all for Voyager, but my clients
browsers dont support it yet, and won't in the next year or two.

Share & Enjoy,

    Oren Ben-Kiki


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


Current Thread