Sharepoint XSLT Transform Issue

While creating custom form of a list if you have encountered given exception.

Error while executing web part: System.StackOverflowException: Operation caused a stack overflow.
at Microsoft.Xslt.NativeMethod.CheckForSufficientStack()
at (XmlQueryRuntime , XPathNavigator , Double , String )
at (XmlQueryRuntime , IList`1 )
at (XmlQueryRuntime , XPathNavigator )
at Root(XmlQueryRuntime )
at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer, Boolean closeWriter)
at System.Xml.Xsl.XmlILCommand.Execute(IXPathNavigable contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter results)
at System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, XmlWriter results)
at Microsoft.SharePoint.WebPartPages.DataFormWebPart.ExecuteTransform(XslCompiledTransform xslCompiledTransform, XsltArgumentList xmlArguments, Boolean bDeferExecuteTransform)
at Microsoft.SharePoint.WebPartPages.DataFormWebPart.PrepareAndPerformTransform(Boolean bDeferExecuteTransform)

in which some time Edit form opens and some time it doesn’t then most probably the issue with your form is too heavy for SharePoint to handle i.e contains a whole lot of fields (here whole lot of can be 50 and above) 🙂 and it is taking more than one second to transform the XSLT.

The best chance you have to avoide this exception is to clean up XSL in the form or remove the controls that take more time to render (like BDC).

To clean up the XSL
1. You can remove the description part of SharePoint controls from your form. It will reduce whole lot of XSLT that you are not using and make your form render faster.
                          The description tag looks something like :
 

2. Remove the unnecessary datafields sharepoint is fetching and that are not used in the form (be very careful here )

NOTE: If you are getting same exception and form never renders then the reason could also be that you have messed up XSLT at someplace and its stuck. Eg. You have copied and pasted a control some where on page and both controls have same ID like id=”ff9{$Pos}”.

In this case try to recall what changes you made in the page and act accordingly.

Leave a Reply

Your email address will not be published. Required fields are marked *