The below code works fine in 9.2.2 (and any version before), but when we execute the below in 9.2.3 we get the following error.  Thanks in advance for your assistance.

 

Cannot convert element() to xs:string?: $status := <EmploymentStatusCode>Active</Employment....

 

declare function local:employmentStatus($employee as element()?) as xs:string?

{

$employee/*:Employment/*:EmploymentStatus/*:EmploymentStatusCode

};

 

declare function local:isActive($employee as element()?) as xs:boolean

{

let $status := local:employmentStatus($employee)

return

  if (string-length($status) > 0)

  then

    contains($status, 'Active')

  else

   false()

};

 

let $ee := <Subscriber><Employment><EmploymentStatus><EmploymentStatusCode>Active</EmploymentStatusCode></EmploymentStatus></Employment></Subscriber>

return

local:isActive($ee)