Subject: RE: [xsl] Optimizing a XSLT From: "Passin, Tom" <tpassin@xxxxxxxxxxxx> Date: Mon, 14 Apr 2003 15:10:21 -0400 |
[Eric Barre] > > I wrote a XSL file to transform a XML file to another XML file, > everything works fine on small file but eventually I will be using it > against large XML file (over 1mg). > When I run it against such a large file it takes for ever to return, I > mean I have to kill it after running for an hour. > Is there a way to optimize the XSL that I have to make it perform > better? The first thing you should do is rewrite the stylesheet to get rid of __ALL__ the disable-output-escaping. There is no reason for this, since you are producing well-formed XML. I suppose you should be congratulated on achieving well-formed output at all with this stylesheet. DO NOT try to split start and end tags across templates. You can do this job and still use well-formed XML in the stylesheet. After that, try to get rid of as many of the tests as possible by means of more clever selection of nodes. Also, make use of the context to reduce the number of path evaluations. Foe example, you have (ignoring the stupid text output statements) - <xsl:value-of select="CSVFile/ROW/ScheduleType"/> <xsl:value-of select="CSVFile/ROW/MarketAvailability"/> If the context were CSVFile/ROW, then you could just write <xsl:value-of select="ScheduleType"/> <xsl:value-of select="MarketAvailability"/> (Of course, these particular statements will not be needed after you restructure teh stylesheet, but the point remains). That would reduce the amount of evaluation needed. With a large file, that could be helpful. BTW, I doubt that the stylesheet is doing what you expect anyway, since expressions like " <xsl:value-of select="CSVFile/ROW/MarketAvailability"/>" will only be picking up the value of the _first_ MarketAvailability child element, and that is probably not what you want. There is no point in more analysis until you fix up the stylesheet, since you will want to restructure it in the process. There is no reason it should take so long for a 1 MB file, so you can have hope for a good result. Cheers, Tom P XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Optimizing a XSLT, Philip Fitzsimons | Thread | [xsl] Cocoon and XSL, nshah |
Re: [xsl] Re: Re: Sorting on call-t, Mike Brown | Date | RE: [xsl] Optimizing a XSLT, David Carlisle |
Month |