[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Un-cdata-section-elements

Subject: Re: Un-cdata-section-elements
From: "Alexander Johannesen" <alexander.johannesen@xxxxxxxxx>
Date: Wed, 22 Mar 2006 10:12:21 +1100
javascript best practices
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.