Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] Slow XSLT

From: Cleyton Jordan <cleytonjordan@----------->
To:
Date: 3/4/2008 1:58:00 PM
Hi Manfred,

I have now tested your suggestion against my old xlst
code and I have to confess that I was very impressed
with your solution!! 

While you were working on you proposed soltuion I also
had a go to improve my old xlst using keys but you
solution is much much faster.

I have produced a very big xml (521 KB) to test all 3
solutions and your solution came on top by far.

I would like to send to you this xml and the
javascript test harness I used for you to have a go
yourself and see the difference. Do you mind if I post
the xml to your personal email address since it is
quite big to post in the forum? I am sure you will be
impressed with your own solution :-)

++++
Do you know any online tutorial, book or any other
training where they teache this technique you showed
me and maybe any other that is relevant to this type
development. 

It appears I will have to read a lot on this topic
since my old xslt code looks really stupid now!! 

I have read some books the best of them maybe was XSLT
1.0 by Michael Kay. However, I do not recall seeing
any example like that. 

I think that your solution is head and 
shoulders above anything I read before and extremely
well coded. Thank you!
+++

By the way these are the results of my test:

My Old XSLT
___________

The transfomation took between 30.00 and 40.00 seconds

Very slow

My New XSLT with Keys
_____________________


The transfomation took between 1.70 and 1.80 seconds

Much inproved perfomance


Your XSLT solution
_____________________


The transfomation took between 0.20 and 0.38 seconds

Wow, this is fast.


Many thanks for the time and effort you put to help me
to come up with a better and faster solution.

Cheers

C


--- Manfred Staudinger <manfred.staudinger@xxxxxxxxx>
wrote:

> Hi,
> 
> In addition to what Michael already discussed:
> 
> On 03/03/2008, Cleyton Jordan
> <cleytonjordan@xxxxxxxxxxx> wrote:
> > Where is this template being called from?
> >
> >  <xsl:template match="Col">
> >   <td colspan="{$msrs}">
> >    <div><xsl:value-of select="@heading"/></div>
> >   </td>
> >  </xsl:template>
> It's called from the "apply-set" template
> 	<tr>
> 		<xsl:apply-templates select="$set"/>
> 	</tr>
> With each recursion, a new $set variable is used,
> which gets its
> initial value here:
> 	<xsl:with-param name="set" select="$set/*"/>
> The new set of nodes is selected to contain all the
> child elements
> (note the /*) of the nodes in the current set. On
> the very last
> recursion $set contains the "Col" elements and those
> match the
> template in question.
> The fact that there are no more child elements is
> used to stop the
> recursion and get the call closed. If you look at
> the point in
> "apply-set" where we called it again
> 	<xsl:call-template name="apply-set">
> 		<xsl:with-param name="set" select="$set/*"/>
> 	</xsl:call-template>
> and where we return from the "active" call, you see
> that "apply-set"
> has already done all it should do, so closing it
> silently.
> 
> Hope this helps,
> 
> Manfred
> 
> 
> On 03/03/2008, Cleyton Jordan
> <cleytonjordan@xxxxxxxxxxx> wrote:
> > Hi Michael,
> >
> >  Thanks for your input.
> >
> >  I will debug the xslt and see if I can undertand
> what
> >  is going on.
> >
> >  Cheer
> >
> >
> >  C
> >
> >
> >  --- Michael Ludwig <mlu@xxxxxxxxxxxxx> wrote:
> >
> >  > Cleyton Jordan schrieb:
> >  > > Hi Manfread,
> >  > >
> >  > > I truly appreciate your help. You are real
> star :)
> >  > >
> >  > > I have just seen your post and before I try
> your
> >  > > changes I would like to ask you what this
> line
> >  > does
> >  > > i.e. which template does it call?
> >  > >
> >  > > <xsl:apply-templates select="$set"/>
> >  >
> >  > It "calls" whatever matches the contents of
> $set.
> >  > What is in
> >  > $set depends on the context. At the place you
> >  > extracted this
> >  > line from, a template by the name "apply-set",
> there
> >  > is an
> >  > xsl:param named "set". The template "apply-set"
> is
> >  > indeed
> >  > called (using xsl:call-template), as it is a
> named
> >  > template.
> >  > Other templates are matching templates - these
> go
> >  > without
> >  > names. They are applied to nodes (using
> >  > xsl:apply-templates)
> >  > based on whether or not they match.
> >  >
> >  > > Where is this template being called from?
> >  > >
> >  > > <xsl:template match="Col">
> >  > >   <td colspan="{$msrs}">
> >  > >    <div><xsl:value-of
> select="@heading"/></div>
> >  > >   </td>
> >  > > </xsl:template>
> >  >
> >  > Incidentally, it is "called", or rather
> applied, by
> >  > the
> >  > xsl:apply-templates above that has caught your
> >  > intention.
> >  > It may not be obvious at first glance, but it
> >  > happens in
> >  > recursion. See the following snippet from
> Manfred's
> >  > example.
> >  >
> >  > >>            <xsl:when test="$set/*">
> >  > >>                    <xsl:call-template
> name="apply-set">
> >  > >>                            <xsl:with-param
> name="set" select="$set/*"/>
> >  > >>                    </xsl:call-template>
> >  > >>            </xsl:when>
> >  >
> >  > Michael
> >  >
> >  >
> >
> >
> >
> >
> >
> >
>
___________________________________________________________
> >  NEW Yahoo! Cars - sell your car and browse
> thousands of new and used cars online!
> http://uk.cars.yahoo.com/
> 
> 



		
___________________________________________________________ 
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent