Subject: RE: [xsl] Slow XSLT From: Cleyton Jordan <cleytonjordan@xxxxxxxxxxx> Date: Thu, 13 Mar 2008 16:56:49 +0000 (GMT) |
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> </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: [xsl] 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Slow XSLT, Michael Kay | Thread | RE: [xsl] Slow XSLT, Michael Kay |
Re: [xsl] No of Times Named Templat, Senthilkumaravelan K | Date | Re: [xsl] No of Times Named Templat, Martin Honnen |
Month |