Re: [xsl] XSL transformations with Javascript

Subject: Re: [xsl] XSL transformations with Javascript
From: "David Rigby" <D.A.Rigby@xxxxxxxxxxxxxx>
Date: Mon, 4 Jun 2001 17:35:57 +0100
transformNode occurs in the user interfae thread and so blocks any GUI
repaints until it is done.  I think there's a 'free threaded' (or something)
property on the MSXML xmldom activeX object that you can specify to make
some operations work asynchronously (presumably loadXML, load and
transformNode?).  Haven't used this myself, so I can't say for sure.
It's exactly the same problem with your animated GIF - the browser won't
receive any repaint messages until after your call to transformNode is
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.


----- Original Message -----
From: "Hasselback, Matt" <matt.hasselback@xxxxxxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Monday, June 04, 2001 4:07 PM
Subject: [xsl] XSL transformations with Javascript

> Hello ALL,
> This question is in three parts, fairly unrelated ... all fall under the
> but I figured to ask them in one message to not annoy those of you, with
> a second message... !
> I apologize, its rather difficult to explain these scenarios clearly,
> hopefully the basics are there, and someone with experience in the
> matter already will pickup on it!
> 1.) I try to display status messages while I am doing transformations,
> etc...
> For example...
>    If I run the following script, the "LOADING..." never gets
> displayed...
>    resultDIV.innerHTML = '<TABLE ALIGN="CENTER" BORDER="0"
> HEIGHT="100%"><TR><TD>LOADING...</TD></TR></TABLE>';
>    resultDIV.innerHTML = data.transformNode(ss.XMLDocument);
>    If I place an alert in between these statements, I can see that it
> does change, but just before the transformation replaces it with the
> transformNode()
>       Ultimately I learned that I could call the second statement with a
> settimeout() and that would achieve the desired results.  I feel like
> this is a bit of a hack, and was hoping someone could explain this in
> greater detail, or even explain why!  Does JavaScript run
> asynchronously?
> 2.)   Next I decide to replace the boring text with an animated GIF!  I
> replaced the first line to be:
>       resultDIV.innerHTML = '<TABLE ALIGN="CENTER" BORDER="0"
> HEIGHT="100%"><TR><TD><IMG
> SRC="images/load_data.gif"></TD></TR></TABLE>';
>       Problem: the GIF isn't animated.  If I display the graphic on any
> page in the <HTML> I have no problems, and the graphic is animated...
> but for some reason, if I set the innerHTML of the div, with the
> graphic, it remains at the first layer/frame of the .GIF.
>      Any ideas on how to make my GIF animated again?
> 3.)  If I place a <script>alert('something here')</script> in my
> stylesheet, perform a transformation, the script never gets executed...
> is it possible to do this?
> Thanks for any of your time, help or information!!!
> -Matt
>  XSL-List info and archive:

 XSL-List info and archive:

Current Thread