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

Merging two XML files

Subject: Merging two XML files
From: "Mak, Lucas Wing Kau" <makw@xxxxxxxxxxxxxxxx>
Date: Mon, 16 Nov 2009 14:41:56 -0500
 Merging two XML files
I want to merge two XML files (i.e. fileA & fileB below) by matching the
values in their <title> elements and grabbing everything from fileA, but only
the <url> element from fileB.

fileA
<collection>
	<record>
		<title>abc</title>
		<name>peter</name>
	</record>
	<record>
		<title>def</title>
		<name>jack</name>
	</record>
	<record>
		<title>ghi</title>
		<name>john</name>
	</record>
</collection>

fileB
<collection>
	<record>
		<title>abc</title>
		<date>11/23/2008</date>
		<url>http://no.com</url>
	</record>
	<record>
		<title>ghi</title>
		<date>12/12/2007</date>
		<url>http://hello.com</url>
	</record>
	<record>
		<title>cmyk</title>
		<date>10/12/2006</date>
		<url>http://hi.com</url>
	</record>
</collection>

Output XML
<collection>
	<record>
		<title>abc</title>
		<name>peter</name>
		<url>http://no.com</url>
	</record>
	<record>
		<title>ghi</title>
		<name>john</name>
		<url>http://hello.com</url>
	</record>
</collection>

How I can do it? I am using XSLT 1.0 since I am more familiar with 1.0 (though
my processor also support 2.0)

Thanks in advance.

Wing (makw@xxxxxxx)

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.