Re: [xsl] Un-cdata-section-elements

Subject: Re: [xsl] Un-cdata-section-elements
From: "Alexander Johannesen" <alexander.johannesen@xxxxxxxxx>
Date: Wed, 22 Mar 2006 10:12:21 +1100
Hi,

On 3/22/06, David Carlisle <davidc@xxxxxxxxx> wrote:
> In theory you should never need to do this.

Yup, I know all about that theory, but reality is a bit more biting. :)

...

> > but the JavaScript
> > engines complain (it doesn't understand CDATA, of course)

> If the page is handled by a conforming XHTML system all aspects of the
> XML markup will be resolved before javascript sees the file.

The problem isn't the validity of the XML, but the validity of the
JavaScript embedded within it. Best practice has it that the opening
and ending parts of an XML CDATA section should be preceded with
single-line comments ('//'), but through XSLT I have no control over
how the processor outputs those CDATA sections. In other words, I
can't do ;

<script type="javascript">
 // <![CDATA[          <----------- It's this first '//' what I'm after
  javascript here ...
 // ]]>
</script>

if I rely on the XSLT processor handle matching <script>'s. Right? I'm
pretty sure the answer is that the best practice I'm wanting isn't
possible through XSLT 1.0.

Almost all my JavaScript code is tucked away nicely in external files,
but at two points in my XHTML page I need to call a function. I could
circumvent all of this through writing an event manager that triggers
given elements after page load, for example, but it seemed like such a
huge effort for such a miniscule task.

So, basically I can't override the DTD's rules for the <script>
element in any way, without relying on buggy / non-conforming XSLT
processors?


Alex
--
"Ultimately, all things are known because you want to believe you know."
                                                         - Frank Herbert
__ http://shelter.nu/ __________________________________________________

Current Thread