web analytics

Exception “stylesheet is too complex” when loading large XSLT in .NET 4.5

Options

codeling 1595 - 6639
@2016-12-20 20:59:48

Getting a XsltException exception says "The stylesheet is too complex" when attempting to load an very large XSLT stylesheet in a Visual Studio C# project.

@2016-12-20 21:01:58

Add the following settings to the app.config file and the problem should go away.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <sectionGroup name="system.xml">
      <section name="xslt" type="System.Xml.XmlConfiguration.XsltConfigSection, System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
    </sectionGroup>
  </configSections>
  <system.xml>
    <xslt limitXPathComplexity="false"/>
  </system.xml>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
  </startup>
</configuration>

Comments

You must Sign In to comment on this topic.


© 2024 Digcode.com