Developer forum

Forum » Templates » XSLT productlist performance

XSLT productlist performance

Filip Lundby
Reply

I'm using the following XSLT to show a productlist. I'm calling the page using this URL: /list.aspx?products=1001;1002;1003; (where the numbers are the productnumbers).

The page is very slow to load - about 2-3 minuts. There's about 500 products in the shop.

What could be wrong?

 

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="xml" omit-xml-declaration="yes" indent="yes" encoding="utf-8"/>
  <xsl:param name="html-content-type"/>

  <xsl:variable name="products">
    <xsl:value-of select="substring-after(/Template/GlobalTags/Global.Pageview.Url,'products=')" />
  </xsl:variable>
  
  <xsl:variable name="hostname">
    <xsl:value-of select="/Template/GlobalTags/Global.Request.Host" />
  </xsl:variable>
    
  <xsl:template match="/Template">    
      <xsl:choose>
      <xsl:when test="$products != ''">

        <xsl:for-each select="loop[@name='Products']/item[contains($products, Ecom.Product.Number)]">

            <xsl:value-of select="Ecom.Product.ID" />
            <xsl:value-of select="Ecom.Product.Name" />
            <xsl:value-of select="Ecom.Product.Price" />
            <xsl:value-of select="Ecom.Product.Number" />

              <form name="{Ecom.Product.ID}" id="{Ecom.Product.ID}" method="get">
                <xsl:value-of select="Ecom.Product.Form.Clean" disable-output-escaping="yes" />
                <xsl:if test="Ecom.Product.Stock &gt; 0"><a class="addtobasket" href="#">Add to bag</a></xsl:if>
              </form>

        </xsl:for-each>


      </xsl:when>
      <xsl:otherwise>

   Empty list.

      </xsl:otherwise>
    </xsl:choose>
    
  </xsl:template>
    
</xsl:stylesheet>

 


Replies

 
Nicolai Høeg Pedersen
Reply

Hi Filip

 

Hard to say.

 

You can run your URL and write &debug=true in the end - that will give you a list of what takes how long to execute - that would give you an idea of which part is slow.

 

BR Nicolai

 
Filip Lundby
Reply

Thanks Nicolai, I'll look into it.

 

You must be logged in to post in the forum