RE: [xsl] XSL transformations with Javascript

Subject: RE: [xsl] XSL transformations with Javascript
From: "Chris Bayes" <Chris@xxxxxxxxxxx>
Date: Mon, 4 Jun 2001 19:35:52 +0100
>As far as the alert is concerned, you won't see any code executed since the
>innerHTML property of a DIV cannot contain <script> tags (no body element
>can - they go in <head>).  Hence your <script> element (and anything else
>that should go in <head>) will be ignored.  To make that work you'd need to
>load the results of the transform in a frame or a new window of some sort.

That isn't quite true. You can put a <script anywhere.
But I wasn't looking at it from this angle. 
The problem is that when you do ...innerHTML = something with a <script
it is inserted but not parsed as it is when the page is initially loaded. So things like
function x(){alert("x")}
are inserted but not parsed. The only way I have got round it in the past is to 
<script id="someScriptID">
function x(){alert("x")}
...inerHTML = something containing above script;

Ciao Chris

XML/XSL Portal

 XSL-List info and archive:

Current Thread