Share via


SharePoint Online Page Layout Pages with Summary Links - Error while executing the web part

You have a page that is based on page layouts that contains summary link web parts or the field control. And when you edit the page properties, you will see an error for the summary links web part or the field control section something like below:

"Error while executing the web part"

along with a correlation ID.

In the ULS logs you will see entries like below:

Application error when access /teams/pagenameaspx, Error=Root element is missing.
at System.Xml.XmlTextReaderImpl.ThrowWithoutLineInfo(String res)
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at Microsoft.SharePoint.Publishing.WebControls.CmsDataFormWebPart.GetXslFile(String templateFileUrl)
at Microsoft.SharePoint.Publishing.WebControls.CmsDataFormWebPart.PopulateDropDown(DropDownList ddl, String selectedValue, String xslUrl, String resourcePrefix)
at Microsoft.SharePoint.Publishing.WebControls.SummaryLinkWebPart.discoverImportedTemplates()
at Microsoft.SharePoint.Publishing.WebControls.SummaryLinkWebPart.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.AddedControl(Control control, Int32 index)
at Microsoft.SharePoint.WebPartPages.WebPart.AddParsedSubObject(Object obj)
at Microsoft.SharePoint.WebPartPages.DataFormWebPart.CreateChildControls()
at System.Web.UI.Control.EnsureChildControls()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

 Error while delta-compile custom Xsl for dataformwebpart: System.Xml.Xsl.XslLoadException: XSLT compile error. An error occurred
 at https://tenantname.sharepoint.com/teams/stylesheet.xsl(0,0). ---> System.Xml.XmlException: Root element is missing.    
 at System.Xml.XmlTextReaderImpl.ThrowWithoutLineInfo(String res)    
 at System.Xml.XmlTextReaderImpl.ParseDocumentContent()    
 at System.Xml.Xsl.Xslt.XsltInput.ReadNextSibling()    
 at System.Xml.Xsl.Xslt.XsltInput.FindStylesheetElement()    
 at System.Xml.Xsl.Xslt.XsltLoader.LoadDocument()    
 at System.Xml.Xsl.Xslt.XsltLoader.LoadStylesheet(XmlReader reader, Boolean include)     -
  -- End of inner exception stack trace ---    
 at System.Xml.Xsl.Xslt.XsltLoader.LoadStylesheet(XmlReader reader, Boolean include)    
 at System.Xml.Xsl.Xslt.XsltLoader.LoadStylesheet(Uri uri, Boolean include)    
 at System.Xml.Xsl.Xslt.XsltLoader.LoadStylesheet(XmlReader reader, Boolean include)    
 at System.Xml.Xsl.Xslt.XsltLoader.Load(Compiler compiler, Object stylesheet, XmlResolver xmlResolver)    
 at System.Xml.Xsl.XslCompiledTransform.CompileToType(XmlReader stylesheet, XsltSettings settings, XmlResolver stylesheetResolver, Boolean debug, TypeBuilder typeBuilder, String scriptAssemblyPath)    
 at Microsoft.Xslt.STransform.CompileToType(XmlReader reader, XsltSettings xsltSettings, XmlResolver xmlResolver)    
 at Microsoft.SharePoint.WebPartPages.DataFormWebPart.CustomizedXslWorker(STransform baseXslt, String webUrl, String Xsl, String baseViewID, String templateType, String viewStyleID)    
 at Microsoft.SharePoint.WebPartPages.DomainRunner.Invoke()

Getting Error Message for Exception System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.Xml.XmlException: Root element is missing.    
 at System.Xml.XmlTextReaderImpl.ThrowWithoutLineInfo(String res)    
 at System.Xml.XmlTextReaderImpl.ParseDocumentContent()    
 at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)    
 at System.Xml.XmlDocument.Load(XmlReader reader)    
 at Microsoft.SharePoint.Publishing.WebControls.CmsDataFormWebPart.GetXslFile(String templateFileUrl)    
 at Microsoft.SharePoint.Publishing.WebControls.CmsDataFormWebPart.PopulateDropDown(DropDownList ddl, String selectedValue, String xslUrl, String resourcePrefix)    
 at Microsoft.SharePoint.Publishing.WebControls.SummaryLinkWebPart.discoverImportedTemplates()    
 at Microsoft.SharePoint.Publishing.WebControls.SummaryLinkWebPart.OnLoad(EventArgs e)    
 at System.Web.UI.Control.LoadRecursive()    
 at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)    
 at System.Web.UI.Page.HandleError(Exception e)    
 at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)    
 at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)    
 at System.Web.UI.Page.ProcessRequest()    
 at System.Web.UI.Page.ProcessRequest(HttpContext context)    
 at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()    
 at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

This usually happens if you have used third party tools to migrate your onpremises SharePoint content to SharePoint Online. The summary links web part leverages XSLT to display the links on the page. This XSLT is stored in "Style Library" document library under "XSL Style Sheets" folder. Check that these XSLT files are not empty. You can download these files to your machine and verify if its zero bytes or empty.

Resolution:

Pick another site that has working pages and page layouts and copy the XSLT files from there and overwrite the empty XSLT files in the problematic site. This should fix the issue.

HTH