Page 1 of 1

saxon:evaluate in XQuery script

Posted: Wed May 29, 2024 5:37 am
by Naoki Hirai
I'm migrating custom refactoring scripts written with XQuery. Those scripts were developed for Oxygen V20.1 and work fine. When I copied those scripts to the 'refactoring' folder of Oxygen V26.1 and executed one of them. Then, I got following error message:
Cannot find a 1-argument function named Q{http://saxon.sf.net/}evaluate()
I looked into the refactoring scripts bundled with V26.1. As a result, the XPath evaluation statement was modified as follows:
V20.1

Code: Select all

let $elements := saxon:evaluate($element_xpath)
V26.1

Code: Select all

let $elements := local:eval($element_xpath, (./*)[1])
Does this mean XPath evaluation method was changed due to a particular reason?
Could you please provide me with information regarding this matter?

Thank you inadvance,
Naoki

Re: saxon:evaluate in XQuery script

Posted: Wed May 29, 2024 7:52 am
by Radu
Hi Naoki,
The XQuery scripts are evaluated using the Saxon libraries. At some point we upgraded the Saxon library in Oxygen to version 12.3 and Saxon's developers have decided to remove completely the support for saxon:evaluate. This means we had to adapt our scripts with their own inline implementation of "local:eval" that you already noticed. So I advice you to do the same for your scripts or switch to using XSLT 3.0 which has an <xsl:evaluate> instruction.
In the future from what I've seen Saxon plans to bring back saxon:eval in order to remove this inconvenience so it might be possible a future version of Oxygen will be able to use saxon:eval directly again in the refactoring scripts.
Regards,
Radu