RE: [xsl] Dynamically changing and running Javascript after XSL transform

Subject: RE: [xsl] Dynamically changing and running Javascript after XSL transform
From: "Passin, Tom" <tpassin@xxxxxxxxxxxx>
Date: Tue, 13 May 2003 15:20:13 -0400
[Kathleen Kappers]
> I do the transformation in the browser - the server does the 
> perl script and
> gives me XML.  Then I want to transform it, but also change 
> some javascript
> and run it instantly, updating the current html page.
> I tried your test and am not getting it called, though.  I 
> tried the onLoad
> call to call a function, too.

The little test example I posted does not need to be called.  If you
make a web page with the example as the only contents, then it will pop
up the alert when the page is loaded.  I tested it before posting and it
worked.  If you cannot get that to happen you need to learn more about
using javascript in a browser before worrying about doing xslt
transformations on the fly.

In what I wrote, I assumed that you already knew how to transform your
xml data in the browser, and could receive the transformed result as a
string.  If so, you would be initiating that transform from a script.
That script could then proceed to do the steps I sketched.

If you do not know how to cause an xsl transformation within the
browser, you need to say so and go looking through FAQs and
documentation for your browser's xml processor (which I assume is
Internet Explorer).  There is some information about it in the list
archives, as well, but of course it is fragmentary.

Here is a sketch of how you might structure your program - you would
have to write all the functions, of course.  It would starts with a call
to run your transform, which would return a string containing javascript
source code.

// Create javascript source code for updating variables
var src = runXSLTtransform(xml,xslt)

// Execute code and update variables

Or you might need to create a data structure which you further process
to update your original values.  Then the eval() would create that data
structure, and you would add a step after the eval -



Tom P

 XSL-List info and archive:

Current Thread