XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Emile HermansSubject: Performance issue with xml
Author: Emile Hermans
Date: 01 Aug 2005 02:39 AM
Hello,

We have the following issue.

We have an input XML that is like this structure:

<root>
<guid>
<item>
<guid>1234567901234567890123456789012</guid>
</item>
<item>
<guid>2345679012345678901234567890123</guid>
</item>
...etc
</guid>
<header>
<item>
<ref_guid>1234567901234567890123456789012</ref_guid>
<headernumber>5678</headernumber>
....all header info of thisguid
...
</item>
<item>
<ref_guid>2345679012345678901234567890123</ref_guid>
<headernumber>7891</headernumber>
....all header info of thisguid
...
</item>
...etc.
</header>
<salesinfo>
<item>
<ref_guid>1234567901234567890123456789012</ref_guid>
<salesunit>pieces</salesunit>
....all sales info of thisguid
...
</item>
<item>
<ref_guid>2345679012345678901234567890123</ref_guid>
<salesunit>boxes</salesunit>
....all sales info of thisguid
...
</item>
...etc
</salesinfo>
<text>
<item>
<ref_guid>1234567901234567890123456789012</ref_guid>
<text>this is textline of guid 1234567901234567890123456789012</text>
</item>
<item>
<ref_guid>1234567901234567890123456789012</ref_guid>
<text>this is 2nd textline of guid 1234567901234567890123456789012</text>
</item>
<item>
<ref_guid>2345679012345678901234567890123</ref_guid>
<text>this is textline of guid 2345679012345678901234567890123</text>
</item>
<item>
<ref_guid>2345679012345678901234567890123</ref_guid>
<text>this is 2nd textline of guid 2345679012345678901234567890123</text>
</item>


...etc
</text>

....
additonal data (partner info etc.. )

</root>


Result xml must be something like:
<resultroot>
<groupedguid>
<guid>1234567901234567890123456789012</guid>
<headernumber>5678</headernumber>
....
<salesunit>pieces</salesunit>
....
<text>this is textline of guid 1234567901234567890123456789012</text>
....
</groupedguid>
<groupedguid>
<guid>1234567901234567890123456789012</guid>
<headernumber>7891</headernumber>
....
<salesunit>boxes</salesunit>
....
<text>this is textline of guid 22345679012345678901234567890123</text>
....
</groupedguid>
</resultroot>


Our XSLT is built this way.

<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<resultroot>
<xsl:for-each select="root/guid/item/guid">
<xsl:variable name="varGUID" select="."/>
<groupedguid>
<guid><xsl:value-of select="$varGUID"/></guid>
<xsl:for-each select="../../../header/item[ref_guid=$varGUID]">
<headernumber><xsl:value-of select="headernumber"/></headernumber>
</xsl:for-each>
<xsl:for-each select="../../../salesinfo/item[ref_guid=$varGUID]">
<salesunit><xsl:value-of select="sales"/></salesunit>
</xsl:for-each>
<xsl:for-each select="../../../text/item[ref_guid=$varGUID]">
<salesunit><xsl:value-of select="text"/></salesunit>
</xsl:for-each>
<!-- additonal sets of data selected with additional for-each elements -->

</groupedguid>
</xsl:for-each>
</resultroot>
</xsl:template>
</xsl:stylesheet>


Header, sales and text information are illustrative there are some 6 additional sets (ie partner info) in the same xml that are selected exactly the same way.
When our input xml becomes relatively large (> 5 mb) with approximately 400 GUIDS we run into performance/memory problems.
Is there a more efficient way to get the same result xml.
Or does anybody have some other suggestions to improve performance.

Thanx in advance,

Emile


Unknownperformance.xsl
Stylesheet with performance problems

Postnext
Ivan PedruzziSubject: Performance issue with xml
Author: Ivan Pedruzzi
Date: 01 Aug 2005 11:45 AM


Try the following solution with xsl:key you may have benefit

Hope this helps
Ivan Pedruzzi
Stylus Studio Team



<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:key name="headeritemFroGUID" match="root/header/item" use="ref_guid"/>
<xsl:key name="salesitemFroGUID" match="root/salesinfo/item" use="ref_guid"/>
<xsl:key name="textitemFroGUID" match="root/text/item" use="ref_guid"/>


<xsl:template match="/">
<resultroot>
<xsl:for-each select="root/guid/item/guid">
<groupedguid>
<guid>
<xsl:value-of select="."/>
</guid>

<xsl:for-each select="key('headeritemFroGUID', .)">
<headernumber>
<xsl:value-of select="headernumber"/>
</headernumber>
</xsl:for-each>


<xsl:for-each select="key('salesitemFroGUID', .)">
<salesunit>
<xsl:value-of select="salesunit"/>
</salesunit>
</xsl:for-each>

<xsl:for-each select="key('textitemFroGUID', .)">
<salesunit>
<xsl:value-of select="text"/>
</salesunit>
</xsl:for-each>


<!-- additonal sets of data selected with additional for-each elements -->
</groupedguid>
</xsl:for-each>
</resultroot>
</xsl:template>
</xsl:stylesheet>

Posttop
Emile HermansSubject: Performance issue with xml
Author: Emile Hermans
Date: 02 Aug 2005 06:16 AM
Hi Ivan,

I will try and test.

Let you know if it works.

Thnx

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.