It is pretty easy to write extension functions for XSLT under .NET. The following code performs a transformation that uses an extension function:
XslTransform xslt = new XslTransform();
xslt.Load("test.xslt");
XsltArgumentList arguments = new XsltArgumentList();
arguments.AddExtensionObject("urn:x", new Extension());
XPathDocument document = new XPathDocument("test.xml");
XmlTextWriter writer = new XmlTextWriter(Console.Out);
xslt.Transform(document, arguments, writer, null);
writer.Close();
All of the public members of the extension class become available within the template as QNames whose prefix is mapped to the URI passed as the first argument to AddExtensionObject. The following data types can be used as parameters or the return value: String, Boolean, Double, XPathNavigator (for result tree fragments), and XPathNodeIterator (for node sets).