XslCompiledTransform xslt = new XslCompiledTransform(); //XmlSecureResolver resolver = new XmlSecureResolver(new XmlUrlResolver(),http://localhost:821); XsltSettings settings = XsltSettings.TrustedXslt; settings.EnableDocumentFunction = true; //Load the XSL stylsheet into the XslCompiledTransform object xslt.Load(xslUrl, settings, new XmlUrlResolver());
----说明:关键点是使用XsltSettings settings = XsltSettings.TrustedXslt;