How to Add XsltListView webpart to sharepoint publishing page

 In your publishing page, add below mentioned XML with these replacements –

Replace,

 ListDisplayName – name of your sharepoint List

 Title – Title of your webpart

ID – Generate a unique and add to it.

ID attribute in <View> element should have unique ID.

In <ViewFields> collection, add the viewfields as per your requirement.

Add your custom xsl within <xsl></xsl> element. Instead of adding your custom xsl inline you can also mention your custom xsl filename but that file must reside at 14hive/template/layouts/xsl folder. It’s the same folder where main.xsl is seen. However, please note it is seen that xsltListViewWebpart throws access denied error for anonymous users if it refers custom xsl file thru a link. This is a sharepoint bug. Visit this link for details – http://sharepoint.stackexchange.com/questions/15804/anonymous-users-denied-access-to-xsl-stylesheet/67237#67237

Workaround is to use inline custom xsl.

<WebPartPages:XsltListViewWebPartrunat=serverDescription=“” ListDisplayName=NewsPartOrder=2Default=FALSEHelpLink=“”AllowRemove=TrueIsVisible=TrueAllowHide=TrueUseSQLDataSourcePaging=TrueExportControlledProperties=FalseIsIncludedFilter=“”DataSourceID=“”Title=“YourWebPartTitleViewFlag=8NoDefaultStyle=TRUEAllowConnect=TrueDisplayName=linksFrameState=NormalPageSize=-1PartImageLarge=“”AsyncRefresh=FalseExportMode=NonSensitiveDataDir=DefaultDetailLink=“”ShowWithSampleData=FalseFrameType=TitleBarOnlyPartImageSmall=“”IsIncluded=TrueSuppressWebPartChrome=TrueAllowEdit=TrueViewGuid=“”ChromeType=TitleOnlyAutoRefresh=FalseAutoRefreshInterval=60AllowMinimize=TrueWebId=00000000-0000-0000-0000-000000000000ViewContentTypeId=0xInitialAsyncDataFetch=FalseGhostedXslLink=main.xslMissingAssembly=Cannot import this Web Part.HelpMode=ModelessListUrl=“”ID=g_088ca6af_0d31_4001_8047_6a65b56f766bConnectionID=00000000-0000-0000-0000-000000000000AllowZoneChange=TrueManualRefresh=False__designer:customxsl=fldtypes_Ratings.xsl__MarkupType=vsattributemarkup__WebPartId={088CA9AF-0D31-4001-8047-6A65B56F766B}__AllowXSLTEditing=trueWebPart=trueHeight=“”Width=“” >

<ParameterBindings>

<ParameterBindingName=dvt_sortdirLocation=Postback;Connection/>

<ParameterBindingName=dvt_sortfieldLocation=Postback;Connection/>

<ParameterBindingName=dvt_startpositionLocation=PostbackDefaultValue=“” />

<ParameterBindingName=dvt_firstrowLocation=Postback;Connection/>

<ParameterBindingName=OpenMenuKeyAccessibleLocation=Resource(wss,OpenMenuKeyAccessible)/>

<ParameterBindingName=open_menuLocation=Resource(wss,open_menu)/>

<ParameterBindingName=select_deselect_allLocation=Resource(wss,select_deselect_all)/>

<ParameterBindingName=idPresEnabledLocation=Resource(wss,idPresEnabled)/>

<ParameterBindingName=NoAnnouncementsLocation=Resource(wss,noXinviewofY_LIST)/>

<ParameterBindingName=NoAnnouncementsHowToLocation=Resource(core,noXinviewofY_DEFAULT)/>

<ParameterBindingName=AddNewAnnouncementLocation=Resource(wss,addnewitem)/>

<ParameterBindingName=MoreAnnouncementsLocation=Resource(wss,moreItemsParen)/>

</ParameterBindings>

<XmlDefinition>

<ViewName={B0865833-5130-4DEA-87DA-6B0C47DEDF6C}TabularView=FALSEMobileView=TRUEType=HTMLDisplayName=All ItemsLevel=1BaseViewID=1ContentTypeID=0xImageUrl=/_layouts/images/generic.png>

<Query>

<OrderBy>

<FieldRefName=ModifiedAscending=False/>

</OrderBy>

</Query>

<ViewFields>

<FieldRef Name=Title/>

<FieldRefName=Description0/>

<FieldRefName=LinkFilename/>

<FieldRefName=DocIcon/>

<FieldRefName=News_x0020_Date/>

<FieldRefName=Button_x0020_Text/>

<FieldRefName=Modified/>

<FieldRefName=Editor/>

<FieldRefName=FileLeafRef/>

<FieldRefName=_ModerationStatus/>

<FieldRefName=FileRef/>

</ViewFields>

<RowLimitPaged=TRUE>30</RowLimit>

<ToolbarType=Standard/>

</View>

</XmlDefinition>

<DataFields>

</DataFields>

<Xsl>

<!– Add your custom xsl here –>

 </Xsl>

</WebPartPages:XsltListViewWebPart>

 

 

Trackbacks

Leave a Comment

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