Take a replace like this:
//...
<fx-function signature="my-function() as element()" type="text/xquf">
element "AAA" {"CONTENT"}
</fx-function>
//...
<fx-replace ref="instance()" with="my-function()"></fx-replace>
This will give an error from FontoXPath. Basically saying there's no nodesFactory defined. Which makes sense, we're not passing one. FontoXPath decides to not use the passed contextnode here, because the language is not XQuery or XQUF.
We should pass a nodesFactory in all places where we call fontoxpath with some user-defined script. They might need a nodesFactory.