Page load delays

Discussion in 'XML' started by The alMIGHTY N, Jun 6, 2007.

  1. 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
    The alMIGHTY N, Jun 6, 2007
    #1
    1. Advertising

  2. 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
    Joe Kesselman, Jun 7, 2007
    #2
    1. Advertising

  3. On Jun 6, 7:43 pm, Joe Kesselman <> wrote:
    > 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
    The alMIGHTY N, Jun 13, 2007
    #3
  4. 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
    Joe Kesselman, Jun 13, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Thomas
    Replies:
    2
    Views:
    1,077
    Mario Trams
    Jul 6, 2003
  2. Neil Zanella
    Replies:
    2
    Views:
    10,088
  3. Viswan
    Replies:
    5
    Views:
    602
    Paulo Valentim
    Oct 7, 2004
  4. Replies:
    5
    Views:
    1,654
    Jim George
    Apr 13, 2005
  5. David Tweed

    matched delays in Xilinx ISE?

    David Tweed, May 26, 2005, in forum: VHDL
    Replies:
    0
    Views:
    525
    David Tweed
    May 26, 2005
Loading...

Share This Page