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

Performance

Subject: Performance
From: Richard Mitchell <Richard.Mitchell@xxxxxxxxxxxxx>
Date: Thu, 13 Sep 2001 10:40:59 +0100
xsl if test performance
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">
      &lt;font face="verdana, arial" size="1" color="#000000"&gt;
    </xsl:text>
  </xsl:template>

  <xsl:template name="bfora:subtext-end">
    <xsl:text disable-output-escaping="yes">
      &lt;/font&gt;
    </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

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.