Bug #6256
closedfunction-name returns an empty sequence for node-name#0, string#0 and more?
0%
Description
Hi,
I was faced with a strange behavior of Saxon 12: The XPath expression function-name(node-name#0)
returns an empty sequence. In oposite function-name(node-name#1)
returns fn:node-name
. Same for string#0
, though position#0
returns fn:position
as expected.
I demonstrate it in this GitHub project:
Here you see the result:
Also interesting in Saxon 11 it returned anon
instead of an empty sequence. See: https://github.com/nkutsche/saxon-issue-function-name-zero-arg/actions/runs/6934049245/job/18861459121#step:5:411
Is this a desired behavior?
Best Regards, Nico
Updated by Michael Kay about 1 year ago
- Category set to XPath conformance
- Assignee set to Michael Kay
- Priority changed from Low to Normal
- Platforms .NET, Java added
Thanks, I've added a test case to QT3 test set fn-function-name which confirms this as a bug.
The bug arises because references to context-dependent functions like fn:node-name#0 are actually compiled to an anonymous inline function with a closure, in effect let $var := . return function(){node-name($var)}
, and the anonymous function of course has no function name.
Updated by Michael Kay about 1 year ago
- Status changed from New to Resolved
- Applies to branch 11, 12, trunk added
- Fix Committed on Branch 11, 12, trunk added
Fixed in ContextItemAccessorFunction.bindContext()
by giving an explicit name to the constructed CallableFunction
.
Updated by O'Neil Delpratt about 1 year ago
- Fixed in Maintenance Release 12.4 added
Bug fix applied in the Saxon 12.4 Maintenance release. Leaving it marked as 'Resolved' until fix applied on Saxon 11.
Please register to edit this issue