how to change the XML structure using XQuery

Viewed 218

I have a XML file containing Employees Name and the Job done by them. The structure of the XML file is -

<Employee>AAA@A#B#C#D</Employee>
<Employee>BBB@A#B#C#D</Employee>
<Employee>CCC@A#B#C#D</Employee>
<Employee>DDD@A#B#C#D</Employee>

There are thousands of records and I have to change structure to -

<Employee>
  <Name>AAA</Name>
  <Jobs>
   <Job>A</Job>
   <Job>B</Job>
   <Job>C</Job>
   <Job>D</Job>
  </Jobs>
</Employee>

How to get this done using XQuery in BaseX ?

2 Answers
Related