ExtensionFunctionCall return a Node set
Added by Bas Philippus almost 9 years ago
Hi,
I am adding functions to saxon with the ExtensionFunctionCall, however I don't know how to return a set of nodes or a node sequence. Can anyone help me out here?
Kind regards, Bas Philippus
Replies (2)
RE: ExtensionFunctionCall return a Node set - Added by Michael Kay almost 9 years ago
The result type is declared as Sequence. There are a number of implementations of Sequence which you can use. If you're happy to accumulate all the results in memory before returning them, then the most convenient is probably to put the nodes in a Java list, and then
return new SequenceExtent(new ListIterator(list))
As for the nodes themselves, they must implement the NodeInfo interface, and there's a wide range of different ways you can get NodeInfo instances - for starters it depends on whether you are selecting existing nodes, wrapping nodes in an external model such as JDOM, or creating nodes from scratch.
RE: ExtensionFunctionCall return a Node set - Added by Bas Philippus almost 9 years ago
Yes, the SequenceExtent was what I was looking for. Thank you for your time!
Please register to reply