473,386 Members | 1,873 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Merge two xml files on common date field and write out tab-delimited file

I am using the Saxon xml parser and I need some help transforming the
following 2 xml files:

gps.xml:
--------
<?xml version="1.0"?>
<root>
<record>
<longitude>-105.111111</longitude>
<latitude>39.111111</latitude>
<date_time>2003/12/10.16:08</date_time>
</record>
<record>
<longitude>-105.222222</longitude>
<latitude>39.222222</latitude>
<date_time>2003/12/10.16:18</date_time>
</record>
<record>
<longitude>-105.111111</longitude>
<latitude>39.111111</latitude>
<date_time>2003/12/10.16:28</date_time>
</record>
</root>

trans.xml:
----------
<?xml version="1.0"?>
<root>
<header>
<driver_id>driver_id1</driver_id>
<vehicle_id>vehicle_id1</vehicle_id>
<duty_shift_id>duty_shift_id1</duty_shift_id>
<route_id>route_id1</route_id>
<cid_terminal_id>cid_terminal_id1</cid_terminal_id>
</header>
<record>
<date_time>2003/12/10.16:08</date_time>
<tag_id>tag_id1</tag_id>
<stop_location_id>stop_location_id1</stop_location_id>
<fare_type_cd>fare_type_cd1</fare_type_cd>
<blacklist_cd>blacklist_cd1</blacklist_cd>
</record>
<record>
<date_time>2003/12/10.16:18</date_time>
<tag_id>tag_id2</tag_id>
<stop_location_id>stop_location_id2</stop_location_id>
<fare_type_cd>fare_type_cd2</fare_type_cd>
<blacklist_cd>blacklist_cd2</blacklist_cd>
</record>
</root>

I have a klugey, multiple-step solution right now and I would like a
single xsl stylesheet to:

1. Merge the two input file <record>'s on the date_time field.
2. Pass the <header> through as well and wind up with a
tab-delimited flat file with the <header> fields appended to the front
of each group of <record> fields as follows:

merged_tab_delimited.xml:
-------------------------
driver_id1 vehicle_id1 duty_shift_id1 route_id1 cid_terminal_id1
-105.111111 39.111111 2003/12/10.16:08 tag_id1 stop_location_id1
fare_type_cd1 blacklist_cd1

driver_id1 vehicle_id1 duty_shift_id1 route_id1 cid_terminal_id1
-105.222222 39.222222 2003/12/10.16:18 tag_id2 stop_location_id2
fare_type_cd2 blacklist_cd2

I'm a total neophyte with xml and I'm sure there is a
straight-forward, elegant solution to this.

TIA
Jul 20 '05 #1
0 1258

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: William Bradley | last post by:
"Marshall Barton" <marshbarton@wowway.com> wrote in message news:9as9lvgpnp783kogctb88c8giaepb5uf6g@4ax.com... > William Bradley wrote: > >I have two cells on a form. One of them is the...
8
by: Ishbel Kargar | last post by:
Since upgrading from old laptop (Windows 98) to new laptop (Windows XP), my mail-merge letters are doing strange things with date formats. For instance, my reminder letter for lapsed subs carries...
2
by: William Wisnieski | last post by:
Hi Everyone, Access 2000 I have some code behind a button that performs a word merge with a query data source. The merge works fine. But what I'd like to do somehow is after the merge is...
2
by: Lyn | last post by:
Hi, I have a text control on a form which is bound to table field StartDate which is in Date format. When updating the table record via the form, any data entered into the StartDate control is...
4
by: Dadio | last post by:
Hello On my Access database form I have a command button which opens a Word mail merge document in which I have created a number of fields (Title, FirstName, LastName, Address1 etc.) I would...
8
by: Darryl Kerkeslager | last post by:
I hope that although this is 25% Access and 75% Word, that someone will know ... The whole problem here arises because 1) Microsoft acknowledges an 'issue' wherein TextInput type FormFields are...
1
by: Frank Rocco | last post by:
Hello, We have a database that as two datetime fields. field1 has the date and field2 has the time. I need to merge field1 & field2 into field1. Can someone help me with this syntax? P.S....
4
by: Andreas Kasparek | last post by:
Hola! I'm preparing my master thesis about a XML Merge Tool implementation and was wondering if there is any open standard for XML diff regarding topics like: - is a diff result computed on...
10
by: sandraz444 | last post by:
I have an expression in the query under my form to autofill the date under a certain condition but it wont write to the underlying table?? The date shows in the form but not the table. Does anyone...
1
by: kayberrie | last post by:
I want to write a VBA mail merge code. I want to link the code/macro/dohicky to a nifty little button so it makes life easy. I think I can handle the button part, the code part - not so much. I know...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.