I'm implementing the function as an ExtensionFunctionCall subclass.
I did some experimenting and the following code seems to do what I want:

public SequenceIterator call(SequenceIterator[] arguments, XPathContext context) throws XPathException {
            // ...
            ComplexContentOutputter outputter = new ComplexContentOutputter();
            Item item;
            for(SequenceIterator si : arguments) {
                while( (item = si.next()) != null) {
                    outputter.append(item, 0, NodeInfo.ALL_NAMESPACES);
            // ...

Is this the correct way to use the API?

best regards,


From: Michael Kay [mike@saxonica.com]
Sent: Thursday, May 27, 2010 11:28
To: 'Mailing list for the SAXON XSLT and XQuery processor'
Subject: Re: [saxon] Parsing XPath sequences in extension function

I don't really understand your question (especially in conjunction with the title of the post).
What interface are you using for writing the extension function?
The node will be supplied as an instance of net.sf.saxon.om.NodeInfo, and you can use the methods on that interface to navigate from that node to its descendants. I'm not sure why you want to do this in an extension function, however - processing XML data using XPath/XSLT is generally much easier than doing it in Java.


Michael Kay

From: Asplund Marko [mailto:marko.asplund@ixonos.com]
Sent: 27 May 2010 07:19
To: saxon-help@lists.sourceforge.net
Subject: [saxon] Parsing XPath sequences in extension function


I'm trying to write a Saxon extension function that would receive an element node as input and process the element subtree.
What would be the best way to process the input element?
Can I e.g. transform the input from SequenceIterator to a SAX event stream in order to process it?

best regards,