So found a way to work around this by checking if the element is present and only then applying :
First check if EmployeeDetails
is present
Second check before we apply Descendants selector ( this is required otherwise Descendant selector check throws error stated if there are no child elements )
This checks if EmployeeDetails
has any child elements
{
(EmployeesInfo:{
(EmployeeDetails:(payload.EmployeesInfo.EmployeeDetails.. )) if (!isEmpty(payload.EmployeesInfo.EmployeeDetails) )
})if (payload.EmployeesInfo.EmployeeDetails?)
}