Given a file like
<?xml version="1.0" encoding="utf-8"?>
<statuses xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<status>
<StatusID>1056</StatusID>
<ReqDepot>183</ReqDepot>
<ManifestDate>2024-07-05</ManifestDate>
<DeliveryDate>2024-07-08</DeliveryDate>
<ConNo>0000105</ConNo>
<VigoID>0</VigoID>
<TrackingCode>1831110000105</TrackingCode>
<PalletID>1831110000105-02</PalletID>
<StatusCode>DSO</StatusCode>
<StatusTime>16:37:09</StatusTime>
<StatusDate>2024-07-05</StatusDate>
<Notes />
<PODName />
<PODTime>16:37:09</PODTime>
<PODDate>2024-07-05</PODDate>
</status>
<status>
<StatusID>1066</StatusID>
<ReqDepot>183</ReqDepot>
<ManifestDate>2024-07-05</ManifestDate>
<DeliveryDate>2024-07-08</DeliveryDate>
<ConNo>0000105</ConNo>
<VigoID>0</VigoID>
<TrackingCode>1831110000105</TrackingCode>
<PalletID>1831110000105-01</PalletID>
<StatusCode>DSO</StatusCode>
<StatusTime>16:38:03</StatusTime>
<StatusDate>2024-07-05</StatusDate>
<Notes />
<PODName />
<PODTime>16:38:03</PODTime>
<PODDate>2024-07-05</PODDate>
</status>
<status>
<StatusID>1066</StatusID>
<ReqDepot>183</ReqDepot>
<ManifestDate>2024-07-05</ManifestDate>
<DeliveryDate>2024-07-08</DeliveryDate>
<ConNo>0000105</ConNo>
<VigoID>0</VigoID>
<TrackingCode>1831110000105</TrackingCode>
<PalletID>1831110000105-01</PalletID>
<StatusCode>DSO</StatusCode>
<StatusTime>16:38:03</StatusTime>
<StatusDate>2024-07-05</StatusDate>
<Notes />
<PODName />
<PODTime>16:38:03</PODTime>
<PODDate>2024-07-05</PODDate>
</status>
<status>
<StatusID>1067</StatusID>
<ReqDepot>183</ReqDepot>
<ManifestDate>2024-07-05</ManifestDate>
<DeliveryDate>2024-07-08</DeliveryDate>
<ConNo>0000105</ConNo>
<VigoID>0</VigoID>
<TrackingCode>1831110000105</TrackingCode>
<PalletID>1831110000105-03</PalletID>
<StatusCode>DSO</StatusCode>
<StatusTime>16:38:05</StatusTime>
<StatusDate>2024-07-05</StatusDate>
<Notes />
<PODName />
<PODTime>16:38:05</PODTime>
<PODDate>2024-07-05</PODDate>
</status>
</statuses>
I want to reduce this down to just
<?xml version="1.0" encoding="utf-8"?>
<statuses xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<status>
<StatusID>1056</StatusID>
<ReqDepot>183</ReqDepot>
<ManifestDate>2024-07-05</ManifestDate>
<DeliveryDate>2024-07-08</DeliveryDate>
<ConNo>0000105</ConNo>
<VigoID>0</VigoID>
<TrackingCode>1831110000105</TrackingCode>
<PalletID>1831110000105-01</PalletID>
<StatusCode>DSO</StatusCode>
<StatusTime>16:37:09</StatusTime>
<StatusDate>2024-07-05</StatusDate>
<Notes />
<PODName />
<PODTime>16:37:09</PODTime>
<PODDate>2024-07-05</PODDate>
</status>
<status>
<StatusID>1066</StatusID>
<ReqDepot>183</ReqDepot>
<ManifestDate>2024-07-05</ManifestDate>
<DeliveryDate>2024-07-08</DeliveryDate>
<ConNo>0000105</ConNo>
<VigoID>0</VigoID>
<TrackingCode>1831110000105</TrackingCode>
<PalletID>1831110000105-01</PalletID>
<StatusCode>DSO</StatusCode>
<StatusTime>16:38:03</StatusTime>
<StatusDate>2024-07-05</StatusDate>
<Notes />
<PODName />
<PODTime>16:38:03</PODTime>
<PODDate>2024-07-05</PODDate>
</status>
</statuses>
The key to look out for is <ConNo> I need the last <status> node for each <ConNo> only.
Any thoughts on how to achieve this?
thanks in advance