I want something like this:
<msxsl:script language="C#">
??? getNodes() { ... return ... }
</msxsl:script>
<xsl:for-each select="user:getNodes()">
...
</xsl:for-each>
What return type should i use for getNodes()
and what should i put in it's body?
In principle you need to use the XPathNodeIterator to return node sets (as Samjudson says). I take it that the example you gave is a degenerated function, as you do not supply it with any parameters. However, I think it is instructive the see how you could fabricate nodes out of thin air.
However, typically you would want to do something in your function that is not possible in xslt, like filtering a node set based on some criteria. A criteria that is better implemented through code or depends om some external data structure. Another option is just that you would to simplify a wordy expression (as in the example bellow). Then you would pass some parameters to you getNodes function. For simplicity I use a XPath based filtering but it could be anything:
Hopes this helps, Boaz
A quick google for C# xslt msxml revealed a link to the following page which gives many examples of extending XSLT in microsoft environments.
http://msdn.microsoft.com/en-us/magazine/cc302079.aspx
Specifically the section on Mapping Types between XSLT and .Net gives you exactly the information you need:
W3C XPath Type - Equivalent .NET Class (Type)
So in your example I would try XPathNodeLiterator.