Let's have input data:
<Contract num = "0123456789">
<Client role = "1"
name = "Some Company Ltd"
cId = "12345678" />
<Client role = "2"
firstname = "John"
familyname = "Smith"
pId = "311270/1234" />
<Client role = "3"
firstname = "Fred"
familyname = "Brown"
cId = "87654321" />
</Contract>
The required result is different:
<Contract ProcessedDate = "2006-02-05 14:00"
ConractId = "0123456789" >
<Owner ComanyId = "12345678"
Name = "Some Company Ltd" />
<Holder PersonalId = "311270/1234"
Firstname = "John"
Lastname = "Smith" />
<Policyholder CompanyId = "87654321"
Name = "Fred Brown" />
</Contract>