L
Luke Airig
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
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