You can return node sets, but for this requirement wouldn't it be simpler to return a sequence of strings?
Are you asking about the reflexive extension functions in 9.1, or the new integrated extension functions in 9.2? With the new mechanism, it's all very straightforward as everything is strongly typed and you have to return values of the Saxon-defined types such as XdmNode and XdmAtomicValue. With the older mechanism, Saxon tries to recognize whatever object you return - the rules are at
Michael Kay

From: Brian Newman []
Sent: 15 October 2009 15:19
Subject: [saxon] extension functions returning node sets

Using the .NET version of Saxon, is it possible to return a node set from an extension function?

The only alternative  I’ve figured out to do it so far is to return a delimited string which I then tokenize, but I’m wondering if there are better techniques (because if I ever change my extension function to, for example, change the columns of data I’m fetching, I have to .

To give an idea of what I’m doing, I’m querying a database.  Unfortunately, the Saxon database extension isn’t available in .NET.  So, my extension function queries a database and returns the values of multiple columns in the database.  I’m looking for a nice clean way to do that.


Brian Newman CISSP

Software Engineer

Network Security Systems Plus, Inc.

5205 Leesburg Pike, Suite 1502

Falls Church, Virginia 22041