Read It
Have you ever tried add a XsltListViewWebPart to display a list view (e.g. “My Project Tasks” or “My Issues”) to the default landing page of your site and unable to change the title of the webpart, frame type etc. as the code differs from that of a standard web part?
You may have tried this by declaratively copying the XML from an existing page after a customization but still no luck.
Let’s Fix
The following declaration shows how you can use the “ListViewWebPart” to accomplish this (I presume, most of you’ll familiar with the view declaration):
<View List="$Resources:BflResource,ldiv_lists_Folder;/$Resources:BflResource,ldiv_projectTask_Folder;" MobileView="TRUE" MobileDefaultView="TRUE" Type="HTML" Url="$Resources:BflResource,ldiv_lists_Folder;/$Resources:BflResource,ldiv_projectTask_Folder;/MyItems.aspx" BaseViewID="2" ImageUrl="/_layouts/images/issuelst.png" WebPartZoneID="Right" WebPartOrder="1">
<XslLink Default="TRUE">main.xsl</XslLink>
<RowLimit Paged="TRUE">15</RowLimit>
<Toolbar Type="Standard" />
<ViewFields>
<FieldRef Name="LinkTitle" />
<FieldRef Name="StartDate" />
<FieldRef Name="DueDate" />
<FieldRef Name="PercentComplete" />
<FieldRef Name="Status" />
<FieldRef Name="Priority" />
<FieldRef Name="Predecessors" />
</ViewFields>
<Query>
<Where>
<Eq>
<FieldRef Name="AssignedTo" />
<Value Type="Integer">
<UserID />
</Value>
</Eq>
</Where>
<OrderBy>
<FieldRef Name="Status" />
<FieldRef Name="Priority" />
</OrderBy>
</Query>
<![CDATA[
<WebPart xmlns="http://schemas.microsoft.com/WebPart/v2">
<Assembly>Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c
</Assembly>
<TypeName>Microsoft.SharePoint.WebPartPages.ListViewWebPart</TypeName>
<Title>$Resources:core,My_Tasks;</Title>
<FrameState>Normal</FrameState>
<AllowRemove>true</AllowRemove>
<AllowZoneChange>true</AllowZoneChange>
<AllowMinimize>true</AllowMinimize>
<AllowConnect>true</AllowConnect>
<AllowEdit>true</AllowEdit>
<AllowHide>true</AllowHide>
<IsVisible>true</IsVisible>
<MissingAssembly>$Resources:core,ImportErrorMessage;</MissingAssembly>
</WebPart>
]]>
</View>
Finally
Related references:
http://stackoverflow.com/questions/4156014/add-an-xsltlistviewwebpart-to-a-site-defintion-homepage
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webpartpages.xsltlistviewwebpart.aspx
http://stefan-stanev-sharepoint-blog.blogspot.com/2010/06/sharepoint-2010-binaryserializedwebpart.html