By update you mean: replace existing entries from the main file with those from a later update?
I am not sure this can be done with xslt.
If I had to do it, I would do it in Perl.
The files consist basically out of junks of <adb_entry>.
read each junk from <adb_entry line to </adb_entry>
line.
throw each entry into a hash with adb_id as hash key. The content
of each junk needs not to be parsed, it is just a text blob, as
far as this small perl program is concerned.
Read all files sequentially, so that updates either replace a hash entry or make a new one.
Then write out the hash, in numerical order of the hash keys.
--
-- You received this message from the Google ADBusers group. To post to this group, send email to adbu...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/adbusers
---
You received this message because you are subscribed to the Google Groups "ADBusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adbusers+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I think this does the job:
#! /usr/bin/perl -CIOE
use strict;
my %h = ();
my $head = '';
my $has_data = 0;
while (<>) {
/<adb_entry adb_id="(\d+)">/ and do {
my $entry = $_;
my $id = $1;
while (<>) {
$entry .= $_;
/<\/adb_entry>/ and last;
}
$h{$id} = $entry;
$has_data = 1;
next;
};
if (! $has_data) {
$head .= $_;
next;
}
/\s*<timestamp/ and do {
$head .= $_;
next;
};
}
my $count = scalar keys %h;
print $head;
foreach (sort { $a <=> $b } keys %h) {
print $h{$_};
}
print qq| <adb_entry_count count="$count" />
</astrodatabank_export>
|;