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

copy-of breaks javascript in CDATA sections

Subject: copy-of breaks javascript in CDATA sections
From: Felix Nensa <nensa@xxxxxxxx>
Date: Sun, 25 Jan 2009 18:30:07 +0100
 copy-of breaks javascript in CDATA sections
Hi,

I have an XHTML document generated with XSLT (Saxon 9.1) where I need
to insert external third party XHTML fragments.
Basically I do sth. like:

  <xsl:variable name="frag" select="document('http://somehost/somepage.html') />
  <xsl:copy-of select="$frag//div[@id='someid']/div"/>

In some of the external fragments there is some ugly javascript looking like:

  <script type="text/javascript">/*<![CDATA[*/document.write('<script
type="text/javascript"
src="http://somehost/somescript.js"></script>');/*]]>*/</script>

When inserting the above via copy-of it gets written into the document like:

  <script type="text/javascript">/**/document.write('&lt;script
type="text/javascript"
src="http://somehost/somescript.js"&gt;&lt;\/script&gt;');/**/</script>

I know that there is nothing wrong from the XML parsers point of view
but do you see any chance of preventing it from escaping the script
tags inside the document.write()?
Unfortunately I have to take these fragments as they come and cannot
fix the problem there.
So what I am looking for is a workaround to insert these fragments via
XSLT without braking the javascript.
Any chance to solve that?

Kind regards,

Felix

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.