Moving child node to parent level using XML



I have a XML with child nodes which I want them to appear in parent level node using XSL. My XML is not very simple and my knowledge of XSL is not very good. I will be great if any one can provide me a solution.


My Sample XML is as follows:



<env:Envelope
xmlns:env="http://ift.tt/sVJIaE"
<env:Body>
<DPSretrieveResponse
xmlns="http://ift.tt/1AGhXFY">
<DPSdata
xmlns="http://ift.tt/1Ernovc">
<DPSheader>
<Service>PAYE</Service>
<EntityType>EmpRef</EntityType>
</DPSheader>
<CodingNoticesP6P6B FormType="P6B" IssueDate="2008-05-06" SequenceNumber="1375" TaxYearEnd="2009"
xmlns="http://ift.tt/1AGhXWc">
<EmployerRef>123/A6</EmployerRef>
<Name>
<Title>MR</Title>
<Forename>J V</Forename>
<Surname>Scanlon</Surname>
</Name>
<WorksNumber>SCA/466</WorksNumber>
<CodingUpdate>
<TaxCode>NT</TaxCode>
</CodingUpdate>
</CodingNoticesP6P6B>
</DPSdata>
</DPSretrieveResponse>
</env:Body>
</env:Envelope>


What I require is:



<env:Envelope
xmlns:env="http://ift.tt/sVJIaE"
xmlns:xsi="http://ift.tt/ra1lAU"
xmlns:soapenc="http://ift.tt/wEYywg"
xmlns:xsd="http://ift.tt/tphNwY">
<env:Body>
<DPSretrieveResponse
xmlns="http://ift.tt/1AGhXFY">
<DPSdata
xmlns="http://ift.tt/1Ernovc">
<DPSheader>
<Service>PAYE</Service>
<EntityType>EmpRef</EntityType>
</DPSheader>
<CodingNoticesP6P6B FormType="P6B" IssueDate="2008-05-06" SequenceNumber="1375" TaxYearEnd="2009"
xmlns="http://ift.tt/1AGhXWc">
<EmployerRef>123/A6</EmployerRef>
<Name>
</Name>
<Title>MR</Title>
<Forename>J V</Forename>
<Surname>Scanlon</Surname>
<WorksNumber>SCA/466</WorksNumber>
<CodingUpdate>
<TaxCode>NT</TaxCode>
</CodingUpdate>
</CodingNoticesP6P6B>
</DPSdata>
</DPSretrieveResponse>
</env:Body>
</env:Envelope>


Simply, Title, Forename and Surname under Name tag need to be displayed in the same level as Name;



<Name>
</Name>
<Title>MR</Title>
<Forename>J V</Forename>
<Surname>Scanlon</Surname>


Any advice is highly appreciated.


Thank you.


No comments:

Post a Comment