[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Slow XSLT

Subject: RE: Slow XSLT
From: Cleyton Jordan <cleytonjordan@xxxxxxxxxxx>
Date: Thu, 13 Mar 2008 16:56:49 +0000 (GMT)
RE:  Slow XSLT
Hi Michael,

I had created a global variable before like this:

<xsl:variable name="msrs"
select="/Report/Measures/Measure"/>

<xsl:for-each select="$msrs">
 <td>&#xa0;</td>
</xsl:for-each>

But it did not improve the transformation. 

Then I decided to try the For-each loop but to no
avail.

What do you thing about using keys?

Cheers

C

--- Michael Kay <mike@xxxxxxxxxxxx> wrote:

>   <xsl:template match="Cell[not(*)]">
>     <xsl:for-each select="/Report/Measures/Measure">
>       <td> </td>
>     </xsl:for-each>
>   </xsl:template>
> 
> Try assigning /Report/Measures/Measure to a global
> variable so it only has
> to be evaluated once.
> 
> Michael Kay
> http://www.saxonica.com/
> 
>  
> 
> > -----Original Message-----
> > From: Cleyton Jordan
> [mailto:cleytonjordan@xxxxxxxxxxx] 
> > Sent: 13 March 2008 16:33
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject: RE:  Slow XSLT
> > 
> > Hi Michael, David,
> > 
> > XSLT 1.0
> > 
> > The push-processing coding style demonstrated by
> David 
> > Carlisle improved the transformation quite a bit
> but it still 
> > takes 7 seconds to transform in IE and Firefox.
> > 
> > I was wondering if using KEYS it would help to
> improve the 
> > transformation?
> > 
> > If so, I would appreciate if you could help me to
> produce a 
> > key that would work.
> > 
> > I am posting the latest XSLT below with some
> formatting. I am 
> > also posting an XML but it is not going to be as
> long as the 
> > one I am using locally (1.5mb).
> > 
> > Cheers
> > 
> > C
> > 
> > Here is the latest working XSLT however it is slow
> 
> > _________________________________________________
> > 
> > <?xml version="1.0" encoding="UTF-8"?>
> > <xsl:stylesheet version="1.0"
> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> >   <xsl:strip-space elements="*"/>
> > 
> >   <xsl:decimal-format name="fd1"
> decimal-separator="."
> > grouping-separator="," NaN=" \"/>
> >   <xsl:param name="axisHeads" select="'false'"/>
> >   <xsl:param name="sortCol" select="'0'"/>
> >   <xsl:param name="sortCell" select="'0'"/>
> >   <xsl:param name="dataType" select="'text'"/>
> >   <xsl:param name="sortOrder"
> select="'ascending'"/>
> >   <xsl:param name="ltCurFormat"
> > select="'$##,###.00'"/>
> >   <xsl:param name="ltNumFormat"
> > select="'###,.00'"/>
> >   <xsl:param name="heading"/>
> >   <xsl:param name="height" select="'500'"/>
> >   <xsl:param name="width" select="'880'"/>
> >   <xsl:param name="id" select="'audit'"/>
> > 
> > 
> >   <xsl:template match="Report">
> >     <html>
> >       <head>
> >         <title>report</title>
> >       </head>
> >       <body>
> >         <table border="1">
> >           <xsl:apply-templates/>
> >         </table>
> >       </body>
> >     </html>
> >   </xsl:template>
> >   
> >   <xsl:template match="Row">
> >     <tr>
> >       <xsl:apply-templates/>
> >     </tr>
> >   </xsl:template>
> >   
> >   <xsl:template match="Msr">
> >     <xsl:choose>
> >       <xsl:when test="string(number(@val))
> ='NaN'">
> >         <td align="left" style="overflow:none">
> >           <nobr>
> >             <div style="width:80px;overflow:none">
> >               <xsl:value-of select="@val"/>
> >             </div>
> >           </nobr>
> >         </td>
> >       </xsl:when>
> >       <xsl:otherwise>
> >         <td align="right" style="overflow:none">
> >           <nobr>
> >             <div style="width:80px;overflow:none">
> >               <xsl:variable name="numberVal"
> > select="@val"/>
> >               <xsl:variable name="style"
> > select="@class"/>
> >               <xsl:if test="$numberVal != ''">
> >                 <xsl:choose>
> >                   <xsl:when test="$numberVal =
> '-1' or 
> > $numberVal = '0'">
> >                     <xsl:text
> > xml:space="preserve">-</xsl:text>
> >                   </xsl:when>
> >                   <xsl:when test="$numberVal =
> '-1' or 
> > $numberVal = '0'">
> >                     <xsl:text
> > xml:space="preserve">-</xsl:text>
> >                   </xsl:when>
> >                   <xsl:when
> test="$style='wholeNum'">
> >                     <xsl:value-of
> > select="format-number($numberVal,'###,')"/>
> >                   </xsl:when>
> >                   <xsl:when
> test="$style='currency'">
> >                     <xsl:value-of
> > select="format-number($numberVal,$ltCurFormat)"/>
> >                   </xsl:when>
> >                   <xsl:when
> test="$style='percent'">
> >                     <xsl:value-of
> > select="format-number($numberVal * 100,'0.00')"/>
> >                     <xsl:text>%</xsl:text>
> >                   </xsl:when>
> >                   <xsl:otherwise>
> >                     <xsl:value-of
> > select="format-number($numberVal,$ltNumFormat)"/>
> >                   </xsl:otherwise>
> >                 </xsl:choose>
> >               </xsl:if>
> >               <xsl:if test="$numberVal = ''">
> >                 <xsl:text
> > xml:space="preserve">-</xsl:text>
> >               </xsl:if>
> >             </div>
> >           </nobr>
> >         </td>
> >       </xsl:otherwise>
> >     </xsl:choose>
> >   </xsl:template>
> > 
> >   <xsl:template match="Cell[not(*)]">
> >     <xsl:for-each
> select="/Report/Measures/Measure">
> >       <td> </td>
> >     </xsl:for-each>
> >   </xsl:template>
> >  
> > </xsl:stylesheet>
> > 
> > 
> > =====================================
> > 
> > XML
> > ___
> > 
> > 
> > <?xml version="1.0" encoding="utf-8" ?>
> > <Report name="audit" title="Audit"
> date="03-11-2008">
> >   <Measures>
> >     <Measure idx="1" heading="Total Pages"
> > class="num1"/>
> >     <Measure idx="2" heading="Cost" class="cur1"/>
> >     <Measure idx="3" heading="Total Ads"
> > class="num1"/>
> >     <Measure idx="4" heading="Insert Pages"
> > class="num1"/>
> >   </Measures>
> >   <Columns>
> >     <ColGrp heading="Month">
> >       <ColGrp heading="2003">
> >         <ColGrp heading="Quarter 1">
> >           <Col heading="January"/>
> >         </ColGrp>
> >       </ColGrp>
> >     </ColGrp>
> >   </Columns>
> 
=== message truncated ===



		
___________________________________________________________ 
Yahoo! Photos  NEW, now offering a quality print service from just 8p a photo http://uk.photos.yahoo.com

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.