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

Performance problem in transformation

Subject: Performance problem in transformation
From: Shashank Rajvanshi <srajvans@xxxxxxxxxxxxxx>
Date: Thu, 21 Jun 2001 16:34:27 -0400
xsl if counter
I am trying to filter out duplicate records from   input XML document.
If  I have around 80 records in the XML document and out of which 43 are

unique, transformation is taking forever to complete.  (the size of this

input XML document is 223K)

Can you suggest any better ways of  removing duplicate records ?

Following is my stylesheet code

<?xml version='1.0' encoding='utf-8' ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:lxslt="http://xml.apache.org/xslt"
    xmlns:java="http://xml.apache.org/xslt/java"
    version="1.0">

<!-- These parameters should be set by the caller of this stylesheet -->



<!-- Get the number of records -->
<xsl:variable name="count" select="count(//sales_orders_sd_doc)"/>

<xsl:variable name="unique-list"
select="//sales_orders_sd_doc[not(.=following::sales_orders_sd_doc)]" />

<xsl:variable name="unique-count" select="count($unique-list)" />


<!-- Main template -->
<xsl:template match="/event">
 <ROOT message="test">
 <!-- Calling outer-loop template -->
 <xsl:call-template name="outer-loop">
 </xsl:call-template>
 </ROOT>
</xsl:template>

<!-- outer-loop template -->
<xsl:template name="outer-loop">

    <!-- Set a counter to start with 1 -->

 <xsl:param name="counter" select="1"/>
 <xsl:param name="counter2" select="1"/>
 <xsl:param name="docNumber" select="$unique-list[$counter2]"/>

 <xsl:choose>
 <xsl:when test="$docNumber=/event/sales_orders_sd_doc[$counter]">
 <xsl:param name="test" select="1"/>
 <Row>
  <AA>
         <xsl:value-of select="/event/sales_orders_base_uom[$counter]"/>

        </AA>
  <C>
         <xsl:value-of select="/event/sales_orders_dlv_qty[$counter]"/>
        </C>
  <BBB>
         <xsl:value-of
select="/event/sales_orders_exchg_rate_v[$counter]"/>
        </BBB>
  <D>
         <xsl:value-of select="/event/sales_orders_sd_doc[$counter]"/>
        </D>
 </Row>
 <!-- Check the counter -->
     <xsl:if test="$unique-count >= $counter2">
     <!-- If counter is less than count call template inner-loop -->
        <xsl:call-template name="outer-loop">
    <!-- Increment the counter and pass it to the template -->
          <xsl:with-param name="counter2" select="($counter2)+ 1"/>
    <xsl:with-param name="counter" select="1"/>
         </xsl:call-template>
     </xsl:if>
 </xsl:when>
 <xsl:otherwise>
 <!-- Check the counter -->
     <xsl:if test="$count > $counter">
     <!-- If counter is less than count call template inner-loop -->
        <xsl:call-template name="outer-loop">
    <!-- Increment the counter and pass it to the template -->
          <xsl:with-param name="counter" select="($counter)+ 1"/>
    <xsl:with-param name="counter2" select="$counter2"/>
        </xsl:call-template>
     </xsl:if>

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

</xsl:stylesheet>


Thanx in advance!
Shashank


 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.