I am switching from Saxon 9.3 (PE) to more recent version. I am using Extension functions (with "extends ExtensionFunctionDefinition")
I have arguments defined as
public SequenceType[] getArgumentTypes() {
return new SequenceType[] {SequenceType.ANY_SEQUENCE, SequenceType.ANY_SEQUENCE, SequenceType.NODE_SEQUENCE, SequenceType.SINGLE_STRING};
}
And in the XSLt, the call is made using for exemple a variable on the first argument, which is a built up XML section.
<xsl:variable name="graphXML">
<CHART>
<xsl:attribute name="FORMAT">PNG</xsl:attribute>
<xsl:attribute name="HEIGHT">
...
</xsl:variable>
Upon call,
private static class GrapheurCall extends ExtensionFunctionCall {
private static final long serialVersionUID = 1L;
@Override
public Sequence call(XPathContext context, Sequence[] arguments) throws XPathException {
I needed to change my code because the ExtensionFunctionCall interface changed (previously, I had
public SequenceIterator call(SequenceIterator[] arguments, XPathContext context) throws XPathException { ...
)
I have two problems now:
1) The parameter type changed from SequenceIterator to Sequence. As such
NodeInfo dataNode = (NodeInfo) arguments[0].next();
could no more be used, and
NodeInfo dataNode = (NodeInfo) arguments[0];
gives me a runtime error
net.sf.saxon.value.SingletonItem cannot be cast to net.sf.saxon.om.NodeInfo
though the object received is a TinyTree (as per debug done at runtime).
2) The return value is also different (from SequenceIterator to Sequence) I had previously return new ListIterator(saxon_result);
Which is not possible anymore (saxon_result being a java.util.ArrayList ) And here, i have no idea how to send back my ArrayList as a sequence...
Can any knowledgeable people shed some light on this? Thanks! Fabien