Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xsl] Performance problems with grouping

From: "Michael Kay" <mhk@--------->
To:
Date: 9/1/2004 9:59:00 AM
> is it possible to use the <xsl:key> function on a node-set 
> returned by the 
> ext:node-set() function ?

Assuming that the vendor's implementation of ext:node-set() is reasonably
conformant, yes. The key() function is defined to work on the tree
containing the context node, which can be any tree, including one created
using ext:node-set().

Michael Kay



> 
> What I am performing is the following:
> - I combine two xml files to one (by means of the document() function)
> - this temporary xml file is transformed into a node-set by 
> means of the 
> node-set() extension function
> 
> Now on this temporary file I want to perform grouping. I am 
> using the axis 
> preceding-sibling (a number of times) which produces the 
> correct output. But 
> this is causing big performance problems. For an xml source 
> of about 1MB it 
> already takes a very long time (more than half a hour !). I 
> know that the 
> xsl:key is a faster way, but I don't think I can use that for 
> a temp tree, 
> can I ?
> 
> Temp tree:
> <extended_root>
> <object name="object1" timestamp="15:00:00" instance="0" 
> package="pack1" 
> value="1"/>
> <object name="object2" timestamp="15:00:00" instance="0" 
> package="pack2" 
> value="1"/>
> <object name="object3" timestamp="15:00:00" instance="0" 
> package="pack1" 
> value="3"/>
> <object name="object1" timestamp="15:00:00" instance="1" 
> package="pack1" 
> value="4"/>
> <object name="object1" timestamp="15:30:00" instance="0" 
> package="pack1" 
> value="1"/>
> <object name="object2" timestamp="15:30:00" instance="0" 
> package="pack2" 
> value="1"/>
> <object name="object3" timestamp="15:30:00" instance="0" 
> package="pack1" 
> value="4"/>
> <object name="object1" timestamp="15:30:00" instance="1" 
> package="pack1" 
> value="3"/>
> </extended_root>
> 
> Pro package I need one header with an enumeration of all 
> objects for this 
> package:
> HEADER;pack1;object1;object3;object4
> 
> Under each header a grouping is needed pro timestamp and pro 
> instance. All 
> values for that belongs to this grouping are added to the entry
> 
> HEADER;pack1;object1;object3
> pack1;;SCANNER;15:00:00;Instance0;1,3
> pack1;;SCANNER;15:00:00;Instance1;4,-1
> pack1;;SCANNER;15:30:00;Instance0;1,4
> pack1;;SCANNER;15:30:00;Instance1;3,-1
> 
> HEADER;pack2;object2
> pack2;;SCANNER;15:00:00;Instance0;1
> pack2;;SCANNER;15:30:00;Instance1;1
> 
> To achieve this I have following template:
> 
> <xsl:template match="extended_root">
> 	<xsl:for-each select="object">		
> 		<xsl:variable name="currentPackage" select="@package"/>
> 		<xsl:variable name="currentInstance" 
> select="@instance"/>
> 		<xsl:variable name="currentDateTime" 
> select="@timestamp"/>
> 		
> 		<xsl:if 
> test="not(preceding-sibling::object[@package=$currentPackage])">
> 			<xsl:call-template name="write_header">
> 				<xsl:with-param name="counterList" 
> select="/extended_root/object[(@package=$currentPackage) and 
> (not(@name=preceding-sibling::object/@name))]/@name"/>
> 			</xsl:call-template>
> 		</xsl:if>
> 		
> 		<xsl:if 
> test="(not(preceding-sibling::object[(@package=$currentPackage) 
> and (@instance=$currentInstance) and 
> (@timestamp=$currentDateTime)]))">
> 			<xsl:call-template name="write_datarecord">
> 				<xsl:with-param name="counterList" 
> select="/extended_root/object[(@package=$currentPackage) and 
> (not(@name=preceding-sibling::object/@name))]/@name"/>
> 			</xsl:call-template>
> 		</xsl:if>
> 	</xsl:for-each>
> </xsl:template>
> 
> Writing the header is performed in an acceptable amount of 
> time, but writing 
> the records gives a lot of problems.
> 
> Does anybody has some suggestions how I could improve performance.
> 
> Thanks !
> 
> Kind regards,
> ismael


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent