Saxon is in fact able to handle extension functions that
accept or return DOM Nodes and NodeLists, but there are a number of
restrictions. In particular, if you return a DOM Node or NodeList then it must
contain nodes that belong to an existing Saxon document, for example the
document that was supplied as a DOMSource when the query or transformation
NodeInfo is an interface rather than an implementation, and
the way that you create instances depends on which implementation of NodeInfo
you are using. The two native implementations, referred to as the tiny tree and
the standard tree, are immutable document implementations, which means that you
create an entire tree in one go, typically but not necessarity by parsing a
source XML file, and you cannot then modify it. There are also implementations
of NodeInfo that act as wrappers over DOM, JDOM, or XOM
There is some overview documentation of the NodeInfo
interface in the documentation under "Java API", and more detailed documentation
in the JavaDoc files.
For this kind of enquiry, it would be useful to know what
problem you are trying to solve, and what the constraints are on the solution.
It might be that there is a much better way to solve it than by writing
extension functions that return a NodeList.
I am trying to write an extension function that returns a NodeList. I
understand that with Saxon, all the nodes must be instances of NodeInfo. My
question is, how do I create elements and attributes using NodeInfo?? i.e. how
do I use NodeInfo? I can’t find any documentation on