please help me with below scenario XML Input:
<EmploymentUpdateRequest>
<CompanyNo>0070</CompanyNo>
<EmploymentNo>982116</EmploymentNo>
<Fields>
<FieldValue Name="EmpFrom" Type="Date">
<ValidFrom Format="yyyy-MM-dd">2017-04-14</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2099-12-31</ValidUntil>
<Value Format="yyyy-MM-dd">2017-04-14</Value>
</FieldValue>
</Fields>
</EmploymentUpdateRequest>
<EmploymentUpdateRequest>
<CompanyNo>0070</CompanyNo>
<EmploymentNo>982116</EmploymentNo>
<Fields>
<FieldValue Name="EmpFrom" Type="Date">
<ValidFrom Format="yyyy-MM-dd">2017-01-14</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2017-04-13</ValidUntil>
<Value Format="yyyy-MM-dd">2017-01-14</Value>
</FieldValue>
<FieldValue Name="FORNAMN" Type="String">
<ValidFrom Format="yyyy-MM-dd">2017-01-14</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2017-04-13</ValidUntil>
<Value>Bianca</Value>
</FieldValue>
</EmploymentUpdateRequest>
<EmploymentUpdateRequest>
<CompanyNo>0070</CompanyNo>
<EmploymentNo>982116</EmploymentNo>
<Fields>
<FieldValue Name="EmpFrom" Type="Date">
<ValidFrom Format="yyyy-MM-dd">2017-01-14</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2017-04-13</ValidUntil>
<Value Format="yyyy-MM-dd">2017-01-14</Value>
</FieldValue>
<FieldValue Name="FORNAMN" Type="String">
<ValidFrom Format="yyyy-MM-dd">2017-05-14</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2017-06-13</ValidUntil>
<Value>Bianca</Value>
</FieldValue>
</Fields>
</EmploymentUpdateRequest>
<EmploymentUpdateRequest>
<CompanyNo>0070</CompanyNo>
<EmploymentNo>982116</EmploymentNo>
<Fields>
<FieldValue Name="EmpFrom" Type="Date">
<ValidFrom Format="yyyy-MM-dd">2017-01-14</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2017-04-13</ValidUntil>
<Value Format="yyyy-MM-dd">2017-01-14</Value>
</FieldValue>
<FieldValue Name="FORNAMN" Type="String">
<ValidFrom Format="yyyy-MM-dd">2017-02-14</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2017-03-13</ValidUntil>
<Value>Bianca</Value>
</FieldValue>
</Fields>
</EmploymentUpdateRequest>
</EmploymentUpdateRequests>
This needs to be sorted for the all the same Employment number , child node FORNAMN/ValidFrom date value in ascending order. When there is FORNAMN is not null. If it is null then move all those nodes to bottom of the output and do not sort. Expected output:
<EmploymentUpdateRequest>
<CompanyNo>0070</CompanyNo>
<EmploymentNo>982116</EmploymentNo>
<Fields>
<FieldValue Name="EmpFrom" Type="Date">
<ValidFrom Format="yyyy-MM-dd">2017-01-14</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2017-04-13</ValidUntil>
<Value Format="yyyy-MM-dd">2017-01-14</Value>
</FieldValue>
<FieldValue Name="FORNAMN" Type="String">
<ValidFrom Format="yyyy-MM-dd">2017-01-14</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2017-04-13</ValidUntil>
<Value>Bianca</Value>
</FieldValue>
</EmploymentUpdateRequest>
<EmploymentUpdateRequest>
<CompanyNo>0070</CompanyNo>
<EmploymentNo>982116</EmploymentNo>
<Fields>
<FieldValue Name="EmpFrom" Type="Date">
<ValidFrom Format="yyyy-MM-dd">2017-01-14</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2017-04-13</ValidUntil>
<Value Format="yyyy-MM-dd">2017-01-14</Value>
</FieldValue>
<FieldValue Name="FORNAMN" Type="String">
<ValidFrom Format="yyyy-MM-dd">2017-02-14</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2017-03-13</ValidUntil>
<Value>Bianca</Value>
</FieldValue>
</Fields>
</EmploymentUpdateRequest>
<EmploymentUpdateRequest>
<CompanyNo>0070</CompanyNo>
<EmploymentNo>982116</EmploymentNo>
<Fields>
<FieldValue Name="EmpFrom" Type="Date">
<ValidFrom Format="yyyy-MM-dd">2017-01-14</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2017-04-13</ValidUntil>
<Value Format="yyyy-MM-dd">2017-01-14</Value>
</FieldValue>
<FieldValue Name="FORNAMN" Type="String">
<ValidFrom Format="yyyy-MM-dd">2017-05-14</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2017-06-13</ValidUntil>
<Value>Bianca</Value>
</FieldValue>
</Fields>
</EmploymentUpdateRequest>
<EmploymentUpdateRequest>
<CompanyNo>0070</CompanyNo>
<EmploymentNo>982116</EmploymentNo>
<Fields>
<FieldValue Name="EmpFrom" Type="Date">
<ValidFrom Format="yyyy-MM-dd">2017-04-14</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2099-12-31</ValidUntil>
<Value Format="yyyy-MM-dd">2017-04-14</Value>
</FieldValue>
</Fields>
</EmploymentUpdateRequest>
</EmploymentUpdateRequests>