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

Merging Data

Subject: Merging Data
From: "Kevin Bird" <kevin.bird@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 5 Aug 2004 18:19:36 +0100
merging data
Hi Everyone

I need to combine two sets of data (File A and File B). The structure is as
follows (snippet):

FILE A:
<supplements>
<supp>
	<supp-desc>Half Board</supp-desc>
	<supp-price>#10</supp-price>
</supp>
<supp>
	<supp-desc>All Inclusive</supp-desc>
	<supp-price>#20</supp-price>
</supp>
<supp>
	<supp-desc>Sea View</supp-desc>
	<supp-price>#3</supp-price>
</supp>
...
</supplements>

FILE B:
<supplements>
<supp>
	<supp-desc>Half Board</supp-desc>
	<supp-price>#20</supp-price>
</supp>
<supp>
	<supp-desc>All Inclusive</supp-desc>
	<supp-price>#40</supp-price>
</supp>
<supp>
	<supp-desc>Balcony</supp-desc>
	<supp-price>#5</supp-price>
</supp>
...
</supplements>

REQUIRED OUTPUT:
<supplements>
<supp>
	<supp-desc>Half Board</supp-desc>
	<supp-price source="filea">#10</supp-price>
	<supp-price source="fileb">#20</supp-price>
</supp>
<supp>
	<supp-desc>All Inclusive</supp-desc>
	<supp-price source="filea">#20</supp-price>
	<supp-price source="fileb">#40</supp-price>
</supp>
<supp>
	<supp-desc>Sea View</supp-desc>
	<supp-price source="filea">#3</supp-price>
	<supp-price source="fileb">-</supp-price></supp>
<supp>
	<supp-desc>Balcony</supp-desc>
	<supp-price source="filea">-</supp-price>
	<supp-price source="fileb">#5</supp-price></supp>
...
</supplements>

DESCRIPTION:
I need to compare <supp> nodes based on the text value of <supp-desc>. If the
<supp> exists in both files then the <supp-price> node from File B is added
underneath the <supp-price> node from File A (a "source" attribute is also
added). If the <supp> exists in one file but not the other, a <supp-price>
node with the text value of "-" is added. "Sea View" and "Balcony" are
examples of <supp> being present in one file only.

Any suggestions on how best to achieve the desired result will be greatly
appreciated.


--
Kevin Bird

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.