By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,667 Members | 1,615 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,667 IT Pros & Developers. It's quick & easy.

Page load delays

P: n/a
I have an XSL file that works with a typically large XML data set
generated dynamically from a database. This data is written to the
HTML result as a deep multi-dimensional array that is used by
Javascript functions to build large expanding/collapsing tables to
display the data.

The original developer wrote the page so that many writeln functions
were called in embedded Javascript to actually write the table as the
page was loading. This caused Javascript to throw a "script running
too long" error because the the scripts would have to wait for the
array to finish coming into existence.

I thought it an obvious solution to put an empty DIV on the page
first, wait for the page to finish loading, then use the BODY tag
onload call to run Javascript functions that would reference the
arrays and build the table through the DOM. The page still takes a bit
of time to load but there's a noticeable increase in the performance.

Recently, I decided that I needed to include some sort of "loading"
message so that users don't wonder why the page sits there blank for
several seconds. I included a Javascript function designed to hide the
message as soon as the DOM functions finished.

When I tested this, I found out that the message, contained within an
H1 tag placed well before the XSL started building the arrays, would
not load until the tables were drawn. At first, the message would
never show. After I removed the function to hide it, the message
appeared when the tables appeared.

My theory is that none of the HTML result is being rendered to the
screen until the XSL has completed loading everything... and that the
still significant delay is the result of the XSL loading versus the
DOM manipulation.

So my question is whether there's a way to force the H1 tag to appear
on the screen without having to wait for the XSL to finish parsing all
the data into the multi-dimensional array, which is much further down
in the HTML result.

Thank you for taking the time to read this far!

Nathaniel

Jun 6 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
The alMIGHTY N wrote:
So my question is whether there's a way to force the H1 tag to appear
on the screen without having to wait for the XSL to finish parsing all
the data into the multi-dimensional array, which is much further down
in the HTML result.
That's a browser behavior issue, or perhaps a scripting issue, not an
XML/XSL issue. There's no reason a browser couldn't start showing the
page immediately and then correct it; the question is why your browser
has decided not to do so, whether there's any way to change its mind,
and whether that solution is at all portable.

The traditional HTML solution, of course, would be to divide the problem
-- move the array into a separately loaded document.
--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Jun 6 '07 #2

P: n/a
On Jun 6, 7:43 pm, Joe Kesselman <keshlam-nos...@comcast.netwrote:
The alMIGHTY N wrote:
So my question is whether there's a way to force the H1 tag to appear
on the screen without having to wait for the XSL to finish parsing all
the data into the multi-dimensional array, which is much further down
in the HTML result.

That's a browser behavior issue, or perhaps a scripting issue, not an
XML/XSL issue. There's no reason a browser couldn't start showing the
page immediately and then correct it;
If the XML document is really big, wouldn't that cause some sort of
delay in the loading of the page?

XML needs to be well-formed, right? How would the parser verify the
document is well-formed if it doesn't go through the whole thing
first?

My thought was that first the browser gets the XSL file, which in turn
gets the XML document. The XML document is big so it has to load all
of that first, then it goes through and runs the XSL transformations
on it. Part of those transformations include building the Javascript
array.

Once it loads up the whole XML document and verifies that it's well-
formed, it can start displaying the page as the XSL performs its
transformations.

I don't think it's getting caught on the XSL... I think it's getting
caught on loading the XML.

Of course, I'm not even close to an expert on XML or XSL so I may not
have an understanding of how it all works.
the question is why your browser
has decided not to do so, whether there's any way to change its mind,
and whether that solution is at all portable.

The traditional HTML solution, of course, would be to divide the problem
-- move the array into a separately loaded document.

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Jun 13 '07 #3

P: n/a
The alMIGHTY N wrote:
If the XML document is really big, wouldn't that cause some sort of
delay in the loading of the page?
Depends on how it's being processed.
XML needs to be well-formed, right? How would the parser verify the
document is well-formed if it doesn't go through the whole thing
first?
Depends on how it's being processed. The application could begin
rendering, then stop and flag an error when the problem is encountered,
and recover in some reasonable way. This is an application design issue,
and in your case involves details of exactly how the XSLT processor and
browser have been written and configured.

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Jun 13 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.