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

More Efficient way of mathching ID's

Subject: More Efficient way of mathching ID's
From: "Spencer Tickner" <spencertickner@xxxxxxxxx>
Date: Mon, 3 Apr 2006 12:22:11 -0800
qpid id
Hi Everyone, thanks in advance for the help.

I have an xsl file that looks up elements in one xml file, and inserts
them into another. Pretty common problem on the web and on this list.
I was able to get it working, however the processing is excruciatingly
slow. Was wondering if anyone had some thoughts on speeding up
performance?

*** Combine.xsl ***

<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:variable name="fIntents" select="document('Reference.xml')"/>

<xsl:template match="/">
	<xsl:apply-templates/>
</xsl:template>

<xsl:template match="*">
	<xsl:copy>
		<xsl:copy-of select="@*"/>
		<xsl:apply-templates/>
	</xsl:copy>
</xsl:template>

<xsl:template match="sentence">
	<xsl:variable name="mykey" select="@qpid"/>
	<xsl:copy>
		<xsl:copy-of select="@*"/>
			<xsl:apply-templates select="$fIntents//sentence[@qpid =
$mykey]/intentref"/>
		<xsl:apply-templates/>
	</xsl:copy>
</xsl:template>

</xsl:stylesheet>

*** Without.xml ***

<?xml version="1.0"?>
<document>
	<article qpid="004243">
		<title>Test test Test Test Test</title>
		<sentence qpid="007309">
			<text>
				Test test Test Test Test</text>
		</sentence>
	</article>
	<change-begin/>
	<article qpid="004244">
		<title>Test test Test Test Test</title>
		<sentence qpid="007310">
			<text>Test test Test Test Test</text>
		</sentence>
		<sentence qpid="007311">
			<text>Test test Test Test Test</text>
		</sentence>
	</article>
</document>

*** Reference.xml ***

<?xml version="1.0"?>
<document>
	<article qpid="004243">
		<title>Test2 Test2 Test2 Test2 Test2</title>
		<sentence qpid="007309"><intentref ref="int1"/>
			<text>Test2 Test2 Test2 Test2 Test2</text>
		</sentence>
	</article>
	<change-begin/>
	<article qpid="004244">
		<title>Test2 Test2 Test2 Test2 Test2</title>
		<sentence qpid="007310"><intentref ref="int2"/>
			<text>Test2 Test2 Test2 Test2 Test2</text>
		</sentence>
		<sentence qpid="007311"><intentref ref="int3"/>
			<text>Test2 Test2 Test2 Test2 Test2</text>
		</sentence>
	</article>
</document>


*** With.xml (My Output, Exactly what I need) ***

<?xml version='1.0' ?>
<document>
	<article qpid="004243">
		<title>Test test Test Test Test</title>
		<sentence qpid="007309"><intentref ref="int1"/>
			<text>
				Test test Test Test Test</text>
		</sentence>
	</article>
	<change-begin/>
	<article qpid="004244">
		<title>Test test Test Test Test</title>
		<sentence qpid="007310"><intentref ref="int2"/>
			<text>Test test Test Test Test</text>
		</sentence>
		<sentence qpid="007311"><intentref ref="int3"/>
			<text>Test test Test Test Test</text>
		</sentence>
	</article>
</document>

As a note, reference.xml is much much bigger than this small test and
will have all the qpid's I need to deal with the qpid's in without.xml
file,, as well as a bunch more that will not be needed. I hope this
illustrates what I' trying to do.

Spencer

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.