This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: XSL transformations with Javascript
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] XSL transformations with Javascript
- From: "Chris Bayes" <Chris at Bayes dot co dot uk>
- Date: Mon, 4 Jun 2001 18:04:11 +0100
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi Matt,
Not really questions for this list but here goes.
>
>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?
No. While script is executing nothing much else happens. The settimeout allows the window to update the status bar. Try a forever loop and see what doesn't happen.
>
>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?
Not that I know of.
>
>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?
>
No. simple <script elements are just output to the result tree. <msxsl:script elements are executed during transformation but use only the basic language. alert is a method of the window object so isn't available.
Ciao Chris
XML/XSL Portal
http://www.bayes.co.uk/xml
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list