开发者

XslLoadException - This method has the same name and parameter types as another method in this class

开发者 https://www.devze.com 2023-03-08 06:05 出处:网络
I have an XML file and I have an XSL translator file that came with it which can be used to translate the XML file into an xml file using the NAXML standard format.For some reason, though, I am gettin

I have an XML file and I have an XSL translator file that came with it which can be used to translate the XML file into an xml file using the NAXML standard format. For some reason, though, I am getting an exception when I call the Load function in the XslCompiledTransform

using System.Xml.Xsl;

Problematic block of code:

XslCompiledTransform xlstProcessor = new XslCompiledTransform();
        XsltSettings settings = new XsltSettings();
        settings.EnableScript = true;
        System.Xml.XmlReader reader = System.Xml.XmlReader.Create("C:\\tlog2naxml.xslt");
        System.Xml.XmlResolver resolver = new System.Xml.XmlUrlResolver();
        xlstProcessor.Load(reader, settings, resolver); //Exception occurs here.
        xlstProcessor.Transform(@"C:\vperiodrept.xml", @"C:\test.xml");

I have tried different variations of these parameter开发者_JAVA百科s but I keep getting this exception. When I look at the definitions for the XslCompiledTransform class, I do not see any duplicate method signatures. This is a standard .net class so I wouldn't expect to find any. If anyone has any ideas what might be causing this I would greatly appreciate the help.


The problem is with the scripts in the XSLT you're loading, not with the XslCompiledTransform class; this exception's thrown when the compiler is compiling the scripts in the transform, and it's encountering two methods in the script that have the same signature. The first thing I'd look at is includes - I don't know for certain, but I'd bet the compiler's probably not smart enough to recognize when you've included the same file twice.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号