In an XML, selecting just some children elements and moving them up to the first level
Hi,
I have an XML generated from “Asset Mgmt - Asset” and “Service Agreement Product” Integration Components in a Workflow like this
<?xml version="1.0"encoding="UTF-8"?>
<SiebelMessage MessageId="1-21YC5J" IntObjectName="SW Asset Activation Info" MessageType="Integration Object" IntObjectFormat="Siebel Hierarchical">
<ListOfAsset>
<Asset>
<AssetId>1-2EQT9RX</AssetId>
<ListOfServiceAgreementProduct>
<ServiceAgreementProduct>
<Created>01/01/2013</Created>
<MaintenanceEndDate>05/31/2015</MaintenanceEndDate>
<MaintenanceStartDate>05/01/2015</MaintenanceStartDate>
</ServiceAgreementProduct>
<ServiceAgreementProduct>
<Created>01/01/2014</Created>
<MaintenanceEndDate>08/31/2015</MaintenanceEndDate>
<MaintenanceStartDate>06/01/2015</MaintenanceStartDate>
</ServiceAgreementProduct>
</ListOfServiceAgreementProduct>
</Asset>
</ListOfAsset>
</SiebelMessage>
I would like to take the MaintenanceEndDate and MaintenanceStartDate elements where created is the latest and move them to the top level, so the resulting XML would be like this: