Data View Web Part: Simple Case XSLT View

The Data View Web Part is a very useful web part, especially as it allows you to easily customize the display using XLST.
Below is some sample XSLT showing a very simple view of items in a document library. The view shows documents using the Title column and creates a clickable link to the document concerned using the FileRef column.

  <xsl:stylesheet xmlns:x="" xmlns:d="" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="" xmlns:asp="" xmlns:__designer="" xmlns:xsl="" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal">
    <xsl:output method="html" indent="no"/>
    <xsl:template match="/">
      <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row"/>
      <div class="ms-vb" style="margin-top:5px;padding-left:20px;">
         <table border="0" cellpadding="0" cellspacing="0">
            <xsl:for-each select="$Rows">
               <tr class="ms-vb">
                  <td align="left" valign="middle" width="15px"><img src="/_layouts/images/square.gif" alt="" border="0" align="absmiddle" /></td>
                  <td align="left" valign="middle"><a href="{@FileRef}"><xsl:value-of select="@Title"/></a></td>

Simple XSLT View for Data View Web Part

Published by

Phil Harding

SharePoint Consultant, Developer, Father, Husband and Climber.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s