This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Pure XML & Javascript on client-side
- To: xsl-list at lists dot mulberrytech dot com
- Subject: [xsl] Pure XML & Javascript on client-side
- From: "Thomas Morf" <thmorf at hotmail dot com>
- Date: Mon, 03 Sep 2001 15:06:09 +0200
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi all
My web pages are "pure" xml (meaning no HTML or XHTML is used) which is
styled on the client using CSS. To add interactivity, I use Javascript. I
transform a source XML file with XSLT before it's sent to the browser. The
problem is that, when I use <xsl:output method="text/xml">, entities like '
and " are escaped (eg. ') after I transformed the source XML file with
XSLT
to the right format for the browser. But Javascript jokes at this point,
because it is exspecting the proper character '.
Example:
<input type="checkbox" name="foo" onclick="function(getAttribute('name'))">
becomes
<input type="checkbox" name="foo"
onclick="function(getAttribute('name'))">
Similarly <script>var varname ="name" </script> is not possible.
I tried <xsl:output cdata-section-element="script"> without success. I get
<script> <![CDATA[[var varname ="name"]]></script>, which is again not
understood by the Javascript engine.
I'm aware of possible solutions like using either <?cocoon-format
type="text/xhtml"> or <xsl:output method="html"> which solve my
entitiy-escaping problem, but I have to use XHTML then.
I'm wondering if Mozilla and IE5+ can handle "pure" XML-, why should I use
XHTML instead. Shouldn't it be possible to use a pure XML-Markup publishing
model and still be able to use Javascript on the browser.
Did anyone solve this problem already?
Thanx in advance
Thomas Morf
My platform:
JDK 1.3., Cocoon 1.8, Tomcat 3.1, WinNT 4.0
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list