it seems to me that you are dealing with data, and doing the kind of processing that a database doesvery well. So why are you using XML at all? Couldn't you just model your data into tables and use a DB? There are several portable alternatives that support the kind of processing you seem to be looking for.
I would, but the code needs to be run on many different systems and while I can ensure Perl is installed, I would have a lot of trouble ensuring my database of choice would be.
Thanks for all the suggestions though, I should be able to find something appropriate now :)