Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] Slow XSLT

From: Cleyton Jordan <cleytonjordan@----------->
To:
Date: 3/2/2008 9:46:00 PM
Hi Manfred,

Thank you for your help. I trully appreciate it.

I am trying to code the xslt stylesheet using  your
suggestion (using templates to take care of the
hierarchy) but I have to confess that I am a bit lost.


I was wondering if you could have a look at the
stylesheet below and make the necessary changes.

Also, I have not tried your simpler approach yet
because I am trying to understand this one first.

As for the Javascript, I will create a test harness to
test all the stylesheets and let you know the one with
the best performance.

Cheers


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
	<xsl:param name="axisHeads" select="'false'" />
	<xsl:output indent="yes"/>

	<xsl:variable name="msrs">
		<xsl:choose>
			 <xsl:when test="/Reports/Report/Measures/Measure">
				   <xsl:value-of
select="count(/Reports/Report/Measures/Measure)"/>
			 </xsl:when>
			 <xsl:otherwise>
				   <xsl:value-of select="1"/>
			 </xsl:otherwise>
	   </xsl:choose>
 </xsl:variable>

 <xsl:template match="Reports">
	 <html>
		 <body>
			 <xsl:apply-templates/>
		 </body>
	 </html>
 </xsl:template>

 <xsl:template match="Report" >
     <!-- Top -->
     <div id="g1" style="position: absolute; top: 0px;
left: 0px; width: 400px; height: 12px">
       <table class="grdTop" border="0"
cellspacing="1"  cellpadding="0">
         <tbody>
           <xsl:apply-templates select="Columns" />
         </tbody>
       </table>
     </div>
  </xsl:template>
  
  <xsl:template match="Columns">
        <xsl:apply-templates mode="ColGrp"/>
 </xsl:template>

<!--processing for the innermost ColGrp here-->
<xsl:template match="ColGrp[Col]" mode="ColGrp">
	
 </xsl:template>

<xsl:template match="ColGrp" mode="ColGrp">
        <!--processing here (you can always test the
depth with count(ancestor::ColGrp))-->
        
 </xsl:template>

<!--plus one for Col:-->
<xsl:template match="Col" mode="ColGrp">

 </xsl:template>
 
 <xsl:template match="Measures">
   <xsl:param name="pos" />
   <xsl:for-each select="Measure">
     <xsl:variable name="mPos">
       <xsl:value-of select="position()" />
     </xsl:variable>
     <td align="center">
       <nobr>
         <div class="action" style="width:90px;
overflow:none" onclick="sortFullGrid({$mPos}, {$pos},
'{@class}')">
           <xsl:value-of select="@heading"/>
         </div>
       </nobr>
     </td>
   </xsl:for-each>
 </xsl:template>
 

</xsl:stylesheet>


=========================================

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

> On 02/03/2008, Manfred Staudinger
> <manfred.staudinger@xxxxxxxxx> wrote:
> > I would propose a slightly different approach:
> >
> > <xsl:for-each
> select="/Reports/Report/Columns/ColGrp">
> >    <xsl:apply templates mode="ColGrp"/>
> should read
>    <xsl:apply-templates mode="ColGrp"/>
> >  </xsl:for-each>
> >  passing the parameters needed for your processing
> and using only two
> >  templates for ColGrp: one for the innermost
> ColGrp, and one for the
> >  others
> >  <xsl:templates match="ColGrp[Col]" mode="ColGrp">
> >  processing for the innermost ColGrp here
> add the apply-templates here:
>    <xsl:apply-templates mode="ColGrp"/>
> >  </xsl:for-each>
> 
> Manfred
> 
> 



      ___________________________________________________________ 
Rise to the challenge for Sport Relief with Yahoo! For Good  

http://uk.promotions.yahoo.com/forgood/


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