Subject: [xsl] Performance From: Richard Mitchell <Richard.Mitchell@xxxxxxxxxxxxx> Date: Thu, 13 Sep 2001 10:40:59 +0100 |
OK it seems that performance is now becoming an important issue for people. I myself would like to improve the performance of our stylesheets for our sites as even with only the first viewer generating the page it can still take 6 seconds to generate a page. What is the best way to improve performance? We are using inheriting style sheets so there are a lot of calls to names templates that are overridden in sub stylesheets that xsl:import the parent sheet. Here are a few code snippets that might or might not be bad programming style but they're here for examples to open a discussion on tricks and performance... Making an indent or just creating an empty table element: <xsl:param name="mainindenthtml"> <img src="/wdp/images/spc.gif" height="1"> <xsl:attribute name="width"><xsl:value-of select='$bfora:mainindent'/></xsl:attribute> </img> </xsl:param> <xsl:choose> <xsl:when test="number($bfora:mainindent)"> <TD width="{$bfora:mainindent}"><xsl:copy-of select="$mainindenthtml"/></TD> </xsl:when> <xsl:otherwise> <TD /> </xsl:otherwise> </xsl:choose> Calling sub templates to do things: <xsl:param name="tdgap"><td width="5"><img src="/wdp/images/spc.gif" width="5"/></td></xsl:param> <xsl:if test="number($itemshowkey1) or number($itemshownetworkicon1)"> <TD> <xsl:attribute name="NOWRAP">1</xsl:attribute> <xsl:if test="number($itemshownetworkicon1)"> <xsl:call-template name="shownetworkicon"/> </xsl:if> <xsl:if test="number($itemshowkey1)"> <xsl:call-template name="showkey"/> </xsl:if> </TD> <xsl:copy-of select="$tdgap"/> </xsl:if> Trying hard to keep my tables matching: <TD width="100%" colspan="{1+not(number($itemshowdate2))+not(number($itemshowkey1))*2+not(num ber($itemshowdate1) or number($itemshownetworkicon1))*2+not(number($itemshownetworkicon3) or number($itemshowweblink) or number($itemshowkey3))*2}"> <xsl:if test="number($itemshowtitle)"> <xsl:call-template name="showtitle"/> </xsl:if> </TD> Loading up the keys: <xsl:call-template name="bfora:subtext"/> <xsl:variable name="keys" select="document($keyfile)"/> <xsl:variable name="current" select="."/> <xsl:for-each select="$keys/keyfile/keygroup[contains(concat(',',$keygroup,','),concat(',' ,id,','))]"> <xsl:copy-of select="keyitem[word=$current/publickeyword or word=$current/adminkeyword or word=$current/group or word=$current/network]/itemhtml/*"/> </xsl:for-each> <xsl:call-template name="bfora:subtext-end"/> My text templates: <xsl:template name="bfora:subtext"> <xsl:text disable-output-escaping="yes"> <font face="verdana, arial" size="1" color="#000000"> </xsl:text> </xsl:template> <xsl:template name="bfora:subtext-end"> <xsl:text disable-output-escaping="yes"> </font> </xsl:text> </xsl:template> -- Richard Mitchell Software Developer http://www.vbnonline.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] questions, Michael Kay | Thread | RE: [xsl] Performance, Michael Kay |
RE: [xsl] XSL Javascript prob, Chris Bayes | Date | [xsl] Display an Xml file in a wind, Cecilia Saltori |
Month |