How is it possible to add a XSLT List View Web Part into a Page Layout? I want to do this basically so that instead of adding the web parts I want to multiple pages, I can just apply the specific page layout with the web part attached so its automatically added.

Current scenario I am doing is like this:

  1. Add a Page / Publishing Page.
  2. Insert a List View Web Part into that Page and save.
  3. Access SPD 2013 and extract the declaration for that web part.
  4. Go to Design Manager in SP2013 Browser and add a Page Layout.
  5. Edit the Page Layout and generate "Custom ASP.NET Markup" for inserting into HTML the code extracted for the declaration of the web part.
  6. Go to SPD 2013 and access and edit the created Page Layout HTML file.
  7. Insert the generated code snippet inside the Content Placeholder Main markup on the HTML file.

However, this does not work properly! I get the error "SharePoint can't parse this file, most likely because of an incorrectly formatted SharePoint snippet. The markup at the following location is causing problems. Edit the markup manually to fix it, or replace it with a new snippet from the Snippet Gallery. {Type of error, location of error}. Occurred at: {Time}."

There must be something wrong with the process I am doing. I can't find any resource on the internet and I am stuck. Please help! Thank you!

  • I am looking to do this also, spent a frustrating few days trying to find a solution, did you manage it?
    – Stephen
    Jan 21, 2015 at 10:53

2 Answers 2


Firstly you need to be cautious adding a LVWP to a page layout as it could potentially be used on a different site to the location of the list. If this is the case then you should use a CQWP or in 2013 a Search web part which will not cause any issues across sites.

I do not have much experience with 2013 yet but with 2010 I can add web parts directly to the page layout - is that not possible in 2013?

The other option I have used in 2010 is to export a web part and then add it to the gallery where it can then be added to any page including the page layouts - again perhaps this is not possible in 2013?


You must add this code inside a webpart zone:

<WebPartPages:XsltListViewWebPart ID="XsltListViewWebPart2" 
    runat="server" ListUrl="Lists/PublicDocuments" IsIncluded="True" 
    NoDefaultStyle="TRUE" Title="Public Documents" PageType="PAGE_NORMALVIEW" FrameType="None"
    Default="False" ViewContentTypeId="0x"> 
  • I am trying to use this for "Documents" library by changing the ListUrl property to ListUrl="Documents" but this does not help. It says "List does not exist" while creating the page using the page layout where in I had included this Webpart. Any inputs to resolve this?
    – Amit
    Mar 20, 2015 at 5:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.