Is it possible to join two xml files based on a node value like SQL?
I have two xml files:
<MailPackage>
<Mail>
<id>1</id>
<field_1>foo</field_1>
...
<field_n>bar</field_n>
</Mail>
<Mail>
<id>2</id>
<field_1>... </field_1>
...
</Mail>
....
</MailPackackage>
and
<Transaction_data>
<Transaction>
<id>1</id>
<account_number>10 </account_number>
....
</Transaction>
<Transaction>
<id>1</id>
<account_number> 50 </account_number>
....
</Transaction>
<Transaction>
<id>2</id>
<account_number> 20 </account_number>
....
</Transaction>
</Transaction_data>
Now I'd like to join the two xml files by the value of the 'id' node. The expected result is:
<MailPackage>
<Mail>
<id>1 </id>
<field_1>foo </field_1>
...
<field_n>bar </field_n>
<Transaction_data>
<Transaction>
<Account_number>10</Account_number>
...
</Transaction>
<Transaction>
<Account_number>50 </Account_number>
...
</Transaction>
</Transaction_data>
</Mail>
<Mail>
<id> 2 </id>
<Field_1> ...</Field_1>
...
<Transactions>
<Transaction>
<Account_number> 20 </Account_number>
....
</Transaction>
</Transactions>
</Mail>
</MailPackage>
Can you guys give some help, how to begin?