In MSXML, you can use JavaScript and VBScript, reference in MSXSL: Script
But in .NET, you can only use the language supported by .NET, including C #, VB.NET, JScript, etc.
For example, we want to calculate the sum of people in XML in XSLT,
We can use XSLT like this
xsl: stylesheet>
In MSXML and browsers, we can also do this.
Return D;}]]> msxsl: script> xsl: stylesheet> But if you use the above XSLT in .NET, you will get the following error: Unhandled Exception: System.Xml.Xsl.XsltException: Function 'user: sum ()' has failed ---> System.Reflection.TargetInvocationException:. Exception has been thrown by the target of an invocation ---> Microsoft.JScript. .JScriptException: Function expectedFunction expected at Microsoft.JScript.LateBinding.Call (Binder binder, Object [] arguments, ParameterModifier [] modifiers, CultureInfo culture, String [] namedParameters, Boolean construct, Boolean brackets, VsaEngine engine) at Microsoft.JScript. Latebinding.call (Object [] Arguments, Boolean Construction, Boolean Brackets, vsaEngine Engine) AT Microsoft.xslt.comPiledscripts.jscript.scriptclass_1.sum (Object Nodelist) .... Why? Because in MSXML, Nodelist This NodeSet parameter is an IXMLDomnodeList instance, and its nextNode method returns an IXMLDomnode instance. And .NET maps this NodeSet parameter to instances of System.xml.xPath.XPathNodeItemrator or their subclasses (as for other mapping, refer to XSLT Stylesheet scripting applicing Function SUM (NXPNI) {var D = 0; while (nxpni.movenext ()) D = Convert.Toint32 (NXPni.current.Value); Return D;} msxsl: script> Of course you can also use C # Int sum (xpathnodeiterator nxpni) {INT D = 0; while (nxpni.movenext ()) D = Convert.Toint32 (NXPni.current.value); Return D;} msxsl: script> xsl: stylesheet> Aaron Skonnard has a description in the column "The XML Files" in MSDN Magazine Extending Xslt with Jscript, C #, And Visual Basic .NET If you want to use the extended function under the .NET in XSLT, refer to Microsoft Dare Obasanjo on the Extreme XML column on MSDN. EXSLT Meets XPath From: http://blog.joycode.com/saucer/