Drew on XSLT: "You can import and execute any .NET code you wanted to via extension objects.". It's a pretty cool technique. Playing with it a couple of weeks ago, however, I ran into a tight spot.
As far as I can see, nowhere in the .NET XslTransform docs is is explicitly said that you can create extension functions that return a node-set. However, I tried a couple of times and discovered it is possible simply by making sure your function returns an
However, after experimenting a bit and tons of debugging, I discovered this isn't exactly true. You see, the XslTransform code doesn't expect just any kind of
XPathNodeIterator implementation (it is an abstract class, after all), but instead expects you return an object of a very precise type:
ResetableIterator, which is a subclass of
XPathNodeIterator implemented internally inside System.Xml.dll. So, basically, I see no way you can provide your own extension function returning a custom
XPathNodeIterator, which is something I was interested in doing in order to provide an extension function that could "filter" an existing node-set.