[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Background color problem with dynamic XSL

Subject: Re: Background color problem with dynamic XSL
From: "Thomas B. Passin" <tpassin@xxxxxxxxxxxx>
Date: Mon, 16 Jul 2001 18:04:32 -0400
xsl body background color
I'm on Win2000, IE5.5, recent upgrade, msxml3 in replace mode (which
shouldn't affect my html example, of course).  I have no ideas on why you
didn't get the same result as me when you copied my HTML example!  See if
there is an IE upgrade you can install.  My IE version is

5.50.4522.1800

I hate to ask it, but did you copy my code sample **exactly** when it didn't
work?

Here's what I think might happen with your javascript, though, bearing in
mind that apparently you can only set the document's background color before
the entire document has been completely loaded.

You write the document from a string (created from the xslt transformation).
Then:

> top.rightTop.document.write(str);
> top.rightTop.document.close();
> top.rightTop.document.bgColor = "silver";

I think that this is just like my experiment to change the color after the
document is loaded - and it likewise would fail.  I bet this variation would
work:

 top.rightTop.document.write(str);
 top.rightTop.document.bgColor = "silver";
 top.rightTop.document.close();

I'm assuming that this would be equivalent to setting the color in the
"onLoad" event, but I'm not sure of that.  Of course, if you are going to
create the html as a string, you can just as well put a background color
into the body element when you create the string.

I suggest you simplify this problem to work on it.  Create two frames, or
have your first document open a second window. Write an html string to the
other window, and see what it takes to get it to change color or at least
set the color when it loads.  When that works to your satisfaction, then try
to duplicate the string exactly in a transform and write it to your window
as you have tried to do here.  If it still works differently, then you would
know that using these XML COM  objects causes some difference in how the
browser renders HTML.

It ought to be possible to change the background color by scripting the
style properties.  I haven't tried it, but you might want to.

Cheers,

Tom P

[<richard.whitley@xxxxxxxxxxxx>]

[Tom Passin]
> >
> > Here's what I did:
> >
> > <html>
> > <head>
> > <script language='javascript'>
> >
> > function changecolor(){
> >  document.bgColor='silver'
> > }
> >
> > </script>
> > </head>
> >
> > <body onload='changecolor()'>
> > <h3>This is a test of dynamically setting the document bgcolor</h3>
> >
> > </body>
> > </html>
> >
> > Tom P
> >
> >
> >
>
> Thanks for the idea, Tom.  Even this doesn't work for me (in IE 5.5.)  I'm
now really curious for why it works for you, but not for me.  What OS are
you using?  I'm on NT 4.0.
>
> In addition to calling the internal script from the onload event, as you
did, I also tried setting the property from within the external JS file that
creates the page.  Here's what I used:
>
> ...
> var xslDoc = new ActiveXObject("MSXML2.FreeThreadedDOMDocument");
> var xmlDoc = new ActiveXObject("MSXML2.DOMDocument");
>
> xslDoc.async = false;
> xslDoc.load(xslFile);
>
> xmlDoc.async = true;
> xmlDoc.load(xmlFile);
>
> var tem = new ActiveXObject("MSXML2.XSLTemplate")
> tem.stylesheet = xslDoc;
> var proc = tem.createProcessor();
> proc.addParameter(paramName, paramVal);
> proc.input = xmlDoc;
> proc.transform();
> var str = proc.output;
> alert(str);
> top.rightTop.document.write(str);
> top.rightTop.document.close();
> top.rightTop.document.bgColor = "silver";
> ...
>
> I tried changing bgColor both before and after I call close on the
document object.  It doesn't work either way.  Of course, I removed the
onload event handler from the BODY element in the XSLT before trying this.
>



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.