Custom xsl to generate raw xml of any list view in Sharepoint 2010

While working on Lists and document libraries in sharepoint, it is very likely to come across list related issues. One suhc issue can be that you have configured list view webpart to use custom xsl but on the published page, custom xsl is not rendering correctly. One of the possible approaches to correct these kind of  issues is to troubleshoot and find out whats going on with the list view. In that case, one can simply add below written xsl code in custom xsl file and configure the list view webpart to use this custom xsl to look at the raw xml generated by SharePoint.

This xsl was really helpful to me when I wanted to show a hyperlink with relative site Url thru custom xsl in my ListView webpart. This xsl helped me find out that there is a field ‘FileRef’ in almost all the OOB list views that returns relative site url.

<xsl:stylesheet version=1.0xmlns:xsl=http://www.w3.org/1999/XSL/Transform>

<xsl:output version=1.0indent=yesencoding=UTF-8method=xml/>

<xsl:template match=/>

<xmp>

<xsl:copy-of select=*/>

</xmp>

</xsl:template>

</xsl:stylesheet>

Example Raw Xml of my custom list view

<dsQueryResponse ViewStyleID=”” BaseViewID=”1″ TemplateType=”10035″ RowLimit=”30″>
<Rows>
<Row ID=”1″ PermMask=”0x7fffffffffffffff” HTML_x0020_File_x0020_Type=”” Title=”Test Title” Description0=”Test Descrioption” FileLeafRef=”Temp.txt” FileLeafRef.Name=”Temp” FileLeafRef.Suffix=”txt” FSObjType=”0″ Created_x0020_Date=”1;#2013-05-01 14:42:24″ Created_x0020_Date.ifnew=”1″ FileRef=”/content/cvsFinalTest/News/Temp.txt” FileRef.urlencode=”%2Fcontent%2FcvsFinalTest%2FNews%2FTemp%2Etxt” FileRef.urlencodeasurl=”/content/cvsFinalTest/News/Temp.txt” File_x0020_Type=”txt” HTML_x0020_File_x0020_Type.File_x0020_Type.mapall=”ictxt.gif| |SharePoint.OpenDocuments” HTML_x0020_File_x0020_Type.File_x0020_Type.mapcon=”SharePoint.OpenDocuments” HTML_x0020_File_x0020_Type.File_x0020_Type.mapico=”ictxt.gif” serverurl.progid=”” File_x0020_Type.progid=”SharePoint.OpenDocuments.3″ File_x0020_Type.url=”FALSE” ContentTypeId=”0x01010A00DDBF8BF40B0FAE4EA4665C0652BC878600880F6999E5214941AC791D40DA63F993″ />
</Rows>
</dsQueryResponse>

Leave a Comment

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