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
Stefan FritzSubject: Joining 2 documents lasts too long
Author: Stefan Fritz
Date: 25 Jul 2005 03:32 AM

I'm trying to join 2 XML documents via XSLT.
1. documents contains product information and the 2nd document contains the prices for each product.

The problem is that the prices.xml file is a 3MB file and the products.xml contains about 500 product entries.
It takes about 90 seconds to transform on my machine.
I'm looking for away to reduce the time and would appreciate any input from the XSL gurus. :-)



<xsl:stylesheet exclude-result-prefixes="xsl" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="no" encoding="UTF-8"/>

<xsl:param name="prices" select="document('prices.xml')"/>

<xsl:template match="/">
<xsl:call-template name="Header"/>
<xsl:apply-templates select="txt2xml/line"/>

<!-- only run thi stemplate if the PNR element contains a number-->
<xsl:template match="line[number(PNr)=number(PNr)]">
<xsl:variable name="selector" select="./PNr"/>
<xsl:variable name="priceline" select="$prices/txt2xml/line[PNr=$selector]"/>

<xsl:value-of select="PTxt"/>
<xsl:value-of select="STxt"/>
<xsl:value-of select="PNr"/>
<xsl:value-of select="Man"/>
<xsl:value-of select="MPNr"/>
<xsl:value-of select="$priceline/Cur"/>
<xsl:value-of select="$priceline/Cpr"/>
<xsl:value-of select="$priceline/Lpr"/>
<xsl:value-of select="Avl"/>

<xsl:template name="Header">

<xsl:template match="*"/>



Product XML:

<?xml version="1.0"?>
<PTxt>HP Toner LJ 5L/6L/31xx f ca 2500 Seiten</PTxt>
<STxt>Toner EP-A schwarz 2500pgs 5% deckung</STxt>


Prices XML:
<?xml version="1.0"?>



Tony LavinioSubject: Joining 2 documents lasts too long
Author: Tony Lavinio
Date: 15 Aug 2005 11:37 AM
1. Use the XSLT Profiler to determine exactly where the slowdown is.
2. Most likely, using a key will speed the join.
See http://www.w3.org/TR/xslt#key

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!  

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.