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)
Hi Buddy,
Yes, this is a known bug, it has already been fixed in the latest snapshot [1]. 9.2.4 will be released this or next week.
Hope this helps, Christian
[1] http://files.basex.org/releases/latest/
Buddy Kresge buddy.kresge@known2u.com schrieb am Mi., 17. Juli 2019, 15:36:
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)
basex-talk@mailman.uni-konstanz.de