SharePoint 2010: Customization Of The Data View Web Part - XSLT

Introduction

In this article we will explore how to customize the data view web part XSLT and apply different operation implementation in SharePoint 2010.

Scenario:

  1. When we add a list with SharePoint data view web part, after that when displaying the column @Author (Created by) or Person or Group Column in Data View Web Part (DVWP) SharePoint displays a hyper link.

    How to remove person (Author) hyper link from Data view Web part using XSLT Remove person (Author) hyperlink from Data view Web part using XSLT.

    Solution:


    Solution

  2. In data view web part, Multiline column takes a lot of space.

    How to Wrap Multiline Textin XSLT expression?

    In the below solution, Description is Multiline Column. So after 180 characters you will see “…”.

    Solution:

    data view

  3. In SharePoint, SharePoint List Column Person or Group allows multiple selections. When we add multiple users in that column in data view web part this column displays like: Example. 2; #Akash;3;#Prashantremove special character using JavaScript.

    Example:

    2; #Akash;3;#Prashant

    Output:


    Akash;Prashant

    JavaScript

  4. We display Date, but there are times when we have to display the date and time in different formats, so we can achieve this by Customization of the Data View Web part–XSLT.

    display Date
    1. <xsl:value-of select="ddwrt:FormatDate(string(@StartDate), [LCID],[FORMAT FLAG])"/>  
    Format Flag

    Format Flag Example
    1MM/dd/yyyy. ==> "08/17/2000?
    3dddd, MM dd, yyyy. ==> "Thursday, August 17, 2000?
    4h:mm. ==> "16:32?
    5MM/dd/yyyy h:mm. ==> "08/17/2000 16:32?
    7dddd, MM dd, yyyy h:mm. ==> "Thursday, August 17, 2000 16:32?
    12h:mm:ss. ==> "16:32:32?
    13MM/dd/yyyy h:mm:ss. ==> "08/17/2000 16:32:32?
    15dddd, MMMM dd, yyyy h:mm:ss. ==> "Thursday, August 17, 2000 16:32:32"

    LCID is a language code:

    Reference: List of supported locale identifiers in Word

  5. How to add a hyperlink/Anchor tag to a particular column in the Data View Web Part by editing the XSLT.

    Code

Read more articles on SharePoint:

Up Next
    Ebook Download
    View all
    Learn
    View all