If for what ever reason you want to inspect the XML structure or content of underlying data source retrieved from a SharePoint List/Library before it is rendered via Xslt-transformation, you can do that as follows:
- Open SharePoint Designer 2013 (or 2010 version in case you need it in older SharePoint 2010 context)
- Open the page on which the XsltListViewWebPart is included (list View, SitePage)
- Select to edit the page in raw HTML mode, and locate the 'XsltListViewWebPart' node in the HTML
- Inject the below Xslt-snippet as value for 'Xsl' property of the XsltListViewWebPart definition:
<xsl> <xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal" xmlns:o="urn:schemas-microsoft-com:office:office"> <xsl:output method="xml" indent="yes" /> <xsl:template match="/"> <xmp> <xsl:copy-of select="*"/> </xmp> </xsl:template> </xsl:stylesheet> </xsl>
- Make sure the 'Xsl' property is injected on level of the XsltListViewWebPart, and not as property of the 'View' node;
- Save the page in SharePoint Designer
- Open or refresh the page in browser; if the underlying XML not immediate displayed (XsltListViewWebPart applies caching in it's Xslt pipeline), reload once more
- And you are able to inspect in browser the underlying XML data island structure retrieved by the query applied in the XsltListViewWebPart instance:
No comments:
Post a Comment