Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 30th, 2009, 08:47 PM
Registered User
 
Join Date: Mar 2009
Posts: 4
Thanks: 3
Thanked 0 Times in 0 Posts
Default XSLT - XML Transformation Performance

Hi,

I have an XML report which I want to display as a website (embedded javascript) using the XSLT stylesheet conversion.

Each XML report has multiple components. In the website ui, only the information for a single component is displayed at a time (in the various javascript grids and tables).

During the rendering - the HTML skeletal outline of the website renders within a second, then I wait, depending on the number of components (up to a minute sometimes) for the javascript grids and tables to render and populate.

Ideally I would want the UI to render the HTML outline and the empty javascript grids and tables - once the first component's information is parsed from the XML, populate the grids and tables with the first component's information and then parse the rest of the components information from the XML in the background.

The way XSLT seems to work, all javascript is done after all parsing of the XML happens. Is there no way to embed a javascript section in the XSLT and have a 'run this now - then continue parsing' tag/command?

Or is there a completely different way of doing this? Thank you for help/suggestions.

~Scott <><
 
Old March 31st, 2009, 01:00 AM
Wrox Author
 
Join Date: Jul 2008
Posts: 74
Thanks: 1
Thanked 8 Times in 8 Posts
Send a message via MSN to msellers
Default

Scott,

It might be helpful to get an example of what exactly you are using for the code to display this. But as far as I know in general you are correct JS loads after the transform is done.
__________________
Mitchel Sellers
Microsoft C# MVP, MCITP
Director of Development
IowaComputerGurus Inc.

My blog for .NET and DotNetNuke info

Author of "Professional DotNetNuke Module Programming"

Tech Editor on "Visual Studio 2010 six-in-one" and "Pro C# 4.0"
The Following User Says Thank You to msellers For This Useful Post:
fishstix (October 5th, 2009)
 
Old March 31st, 2009, 04:01 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You haven't said anything about the products you are using. That sometimes suggests people are using Microsoft technology (because Microsofties tend to behave as if that's the only thing there is...) Performance questions are meaningless without knowing the actual products in use.

If you're doing a client-side XSLT transformation driven from Javascript in the IE browser, then there are controls in the API to make things work asynchronously, but I don't know how effective they are. You could probably achieve the effect you are after by having your first XSLT transform generate a skeleton page containing Javascript which when executed fires of further transforms to populate more of the data - but it feels rather cumbersome.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
The Following User Says Thank You to mhkay For This Useful Post:
fishstix (October 5th, 2009)
 
Old March 31st, 2009, 02:53 PM
Registered User
 
Join Date: Mar 2009
Posts: 4
Thanks: 3
Thanked 0 Times in 0 Posts
Default

Hi,

Thank you for your replies.

My question specifically deals with client side performance. The client downloads the XML which has at the header the "?xml-stylesheet type="text/xsl" href="../xsl/foobar.xsl"?" which then downloads and runs the XSL.

IE6 is the primary browser being used to view the website.

mhkay - the idea to get stuff running async sounds promising. I'm worried though that even with multiple XSL transformations being called - would it not still simply perform the big transformation and then run all the javascript at the end?

Thank you for the information - I'll look more into this.

~Scott <><
 
Old April 1st, 2009, 03:51 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

I see no reason why one way should be categorically better than the other although the async method might give a better user inpression as they'll probably see stuff quicker.

On the other hand it'll most likely be harder to build and maintain. For any sort of performance problems you firstly need to have some requirements and then need to implement and measure. It's often wrong to prematurely try optimisation of code.
__________________
Joe
http://joe.fawcett.name/
The Following User Says Thank You to joefawcett For This Useful Post:
fishstix (October 5th, 2009)
 
Old April 13th, 2009, 01:48 PM
Registered User
 
Join Date: Mar 2009
Posts: 4
Thanks: 3
Thanked 0 Times in 0 Posts
Default

Hi,

thanks for all your replies. I thought I'd post my solution.

I tried calling the transformNode() method from my javascript code when transitioning from each component. The method was supposed to load in the XML and XSLT documents and perform the transformation and change the existing website being looked at. Unfortunately, the javascript code within the XSLT never got called - so the only thing transformed was html.

What I ended up doing was loading in the XML and each time the user clicks to change components, I run XPATH queries on the XML from javascript. array = xmlsrc.selectNodes("xpath query"). And I was able load all data from the XML and populate my various javascript tables and grid objects.

Performance changed from loading initial page of 45 seconds and switching components taking 1 second to loading the initial page of 8 seconds and switching components taking 3 to 5 seconds. Once loaded once, switching components goes back to 1 second.

Again, thanks for the help,
~Scott <><





Similar Threads
Thread Thread Starter Forum Replies Last Post
xml schema transformation using xslt xsltbeginner XSLT 1 March 3rd, 2009 10:11 AM
Regarding xml-html transformation of an xml string using xslt and javascript suprakash444 XSLT 1 January 12th, 2009 01:23 AM
XSLT transformation from XML buffer and XSL file sundaramkumar Javascript 1 September 5th, 2005 02:11 AM
Xml to Xml Transformation using xslt ShaileshShinde XSLT 1 July 20th, 2005 01:20 AM
XML to XML transformation using XSLT karjagis XSLT 3 July 30th, 2004 06:13 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.