This discussion is archived
4 Replies Latest reply: Feb 8, 2012 10:04 PM by 814917 RSS

Loading XSLT in faster manner in the browser

814917 Newbie
Currently Being Moderated
Hi,

We had a file Cabinet system that displays a user library tree for each and every user upon his login. user Library tree is a hierarchy of folders and files. We are now displaying this tree using XSLT. i.e., we are fetching out the relavant folder names and file names for that user, forming an XML string and from that we are forming the XSLT and displaying it in the browser.

In the case when user have very large set of folders or files, response time is getting increased a lot and thus causing performance degradation while displaying the user library tree.

Is there any other option so that I could load my tree faster. Is that concept of lazy loading helpful here . If so,please explain us how to implement that functionality .

Are there any other ways of decreasing the response time. please let us know.

Thanks in Advance,
Kartheek.
  • 1. Re: Loading XSLT in faster manner in the browser
    gimbal2 Guru
    Currently Being Moderated
    In the case when user have very large set of folders or files, response time is getting increased a lot and thus causing performance degradation while displaying the user library tree.
    Expected behavior. More data, more processing time. Also XML and XSTL are very verbose, so the data involved that needs to be processed has lots of overhead.
    Is there any other option so that I could load my tree faster.
    Don't display everything comes to mind. Use a more efficient manner of dealing with the content is a second. But first you have to investigate where the processing time is lost. Is it in forming the data, or is the browser which has to process the XSTL and the XML data to form the eventual view (likely HTML)?
    s that concept of lazy loading helpful here
    Perhaps, if you mean loading child data only when a node is unfolded.
    If so,please explain us how to implement that functionality .
    How!? You built the logic you are having problems with, now you expect others to explain to you how to improve it without even having so much as a single line of the code!? I can offer "use javascript and Ajax", but you must at least know of the existence of such technology so you are able to investigate it yourself.
  • 2. Re: Loading XSLT in faster manner in the browser
    814917 Newbie
    Currently Being Moderated
    Hi,

    We have been using the Javascript and Ajax for each of expand or collapse folder action, the problem is only with forming the HTML finally which is taking a considerable time. While we display the folders and files for a particular user, we are forming the complete HTML string and then loading it into the browser. Is ther any performance tuning concept i can implement here?

    Thanks,
    Kartheek.
  • 3. Re: Loading XSLT in faster manner in the browser
    EJP Guru
    Currently Being Moderated
    While we display the folders and files for a particular user, we are forming the complete HTML string and then loading it into the browser. Is ther any performance tuning concept i can implement here?
    Yes, send the HTML to the browser as you create it, instead of creating it all first. You can pipeline the XML creation, XSLT transformation, and HTML writing so it all happens at the same time.
  • 4. Re: Loading XSLT in faster manner in the browser
    814917 Newbie
    Currently Being Moderated
    Hi,

    Thanks for the reply.

    Could you please breifly explain the process of pipelining. As of now, this is what we are doing.


    treeViewXMLBuilder.buildXMLTree(libraryTreeMap, timeZone, userAccessView, browser, dateFormat);
    treeViewXMLBuilder.createEndTreeTag();

    // Transforming XML to HTML
    StringWriter writer = new StringWriter();
    ByteArrayInputStream xmlInputStream = new ByteArrayInputStream(treeViewXMLBuilder.getTree().getBytes("UTF8"));
    xmlInputStream.reset();
    Source xmlSrc = new StreamSource(xmlInputStream);
    Source xsltSrc = new StreamSource(SCFCConfig.getValue(SCFCConstants.XSLT_PATH));
    Result htmlResult = new StreamResult(writer);

    TransformerFactory tf = TransformerFactory.newInstance();
    Templates cachedXSLT = tf.newTemplates(xsltSrc);
    Transformer transformer = cachedXSLT.newTransformer();
    transformer.transform(xmlSrc, htmlResult);
    return writer.toString();

    the String that was returned finally was set to request object and in the JSP we are assigning it to the DIV using its id attribute.


    Please let me know how I can Pipe line the processes you mentioned in the previous reply.

    Thanks,
    Kartheek.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points