Sharepointology is the study and handling of Microsoft Office SharePoint Server

Customize the People Search Results – Part 1

Posted 30Aug08 by Erwin in Development

Out of the box:

First of all let’s start off with showing how the default People Search Results look like:

People Search Default Results

In my opinion not really something you can give to your users to work with. No labels, no design, no clear layout.

This article will try to show you how you can beautify these results a bit.


Let’s try and get ourselfs something to work with for starters. The list of results returned by the search service is in XML format and get’s transformed by using an XSLT. If we can get the XML before it gets translated by the XSLT we can use that XML as input for our custom XSLT.

How do we do this?

  • First you go to your People Search Page and execute a search on a certain name for wich you know you will find results.
  • On the results page you click on Site Actions / Edit page.
  • For the People Search Core Results web part you choose Modify Shared Web Part.

People Search Core Results Edit Web Part

  • Edit the XSL by pressing the XSL Editor button.
  • Save the existing source into a backup XSL file, you can use it later on.
  • Replace the existing XSL by the folowing code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="">
	<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
	<xsl:template match="/">
		<xmp><xsl:copy-of select="*"/></xmp>
  • Save, press OK button on Properties of web part, choose Save and stop editing from the menu.
  • Retry your search and the results will look something like this:
      <Everyone />
      <preferredname>Sharepoint Test</preferredname>
      <jobtitle>Sharepoint Tester</jobtitle>
      <workphone>+32 14 76 78 90</workphone>
      <officenumber>+32 14 76 45 67</officenumber>
      <hithighlightedsummary>moss\<c0>Sharepoint</c0>-<c1>Test</c1>  <ddd /> <c0>Sharepoint</c0> <c1>Test</c1>  <ddd /> <c0>Sharepoint</c0>-<c1>Test</c1> </hithighlightedsummary>
        <HHTitle />
      <responsibility>Testing Sharepoint</responsibility>

      <imageurl imageurldescription="File with extension: aspx">/_layouts/images/html16.gif</imageurl>
      <EveryOne />
  • Copy the XML and save it in a file.

Create the XSL:

Now that we have the XML, we can this data as input for our XSL. I will explain how to create a simple XSL with Sharepoint Designer 2007. If you have experience with making XSL using another tool, be my guest.

  • Open up your Sharepoint Designer 2007 and open the site (File, Open Site) you are working with.
  • Make a new ASPX page (File, New, ASPX).
  • Insert a Data View on the page (Data View, Insert Data View).
  • After you add the Data View, the Data Source Library window opens.

Data Source Library

  • Expand the node that says XML Files, as seen above, and choose Add an XML file. Browse to your XML file that contains the XML data we saved before and hit ok. Hit Yes on the question about importing the XML.
  • Click the dropdown of your file, and choose Show Data.
  • A nice way to get you started is by using the default XSL that Sharepoint uses to display the People Search Results. We saved it earlier on in this article into a backup XSL file. Open this backup file in Notepad or some other text editor, copy the XSL source code, go to your ASPX file in Sharepoint Designer and copy the XSL source code between the <XSL> and </XSL> tags.
  • Go to the Split view in Sharepoint Designer, this will show you the code and the resulting page.
  • Now you can edit the result, you can add labels to your data. Make stuff bold, italic, use tables to design the results.

Testing the new XSL:

  • When you are satisfied with the result copy everything between the <XSL> and </XSL> tags and paste it into your Sharepoint site. Where exactly? Look at the “Preparation” part of this article and search for “pressing the XSL Editor button” that will explain where to paste the XSL source.
  • Save, press OK button on Properties of web part, choose Save and stop editing from the menu.
  • Retry your search and the results will look something like this:

People Search New Results

It’s not much, but it’s a start. I’ll show you what i changed to the Default XSL source, search for DisplayOfficeProfile and compare it with the next source, the differences are the things I changed.

<xsl:template name="DisplayOfficeProfile">
  <xsl:param name="title" />
  <xsl:param name="dep" />
  <xsl:param name="phone" />
  <xsl:param name="skills" />
  <xsl:param name="responsibility" />

  <span class="psrch-Metadata">
  <xsl:if test='string-length($title) > 0'>
   <td><b>Functie: </b></td>
   <td><xsl:value-of select="$title" /></td>
  <xsl:if test='string-length($dep) > 0'>
   <td><b>Afdeling: </b></td>
   <td><xsl:value-of select="$dep" />  </td>
  <xsl:if test='string-length($phone) > 0'>
   <td><b>Telefoon nr: </b></td>
   <td><xsl:value-of select="$phone" />  </td>
   <xsl:if test='string-length($skills) > 0'>
   <td><b>Skills: </b></td>
   <td><xsl:value-of select="$skills" />  </td>
  <xsl:if test='string-length($responsibility) > 0'>
   <td><b>Responsibility: </b></td>
   <td><xsl:value-of select="$responsibility" />  </td>

I also removed the following part of the XSL:

<div class="psrch-Description">
            <xsl:when test="hithighlightedsummary[. != '']">
              <xsl:apply-templates select="hithighlightedsummary" />
            <xsl:when test="aboutme[. != '']">
              <xsl:value-of disable-output-escaping="yes" select="aboutme"/>
            <xsl:when test="responsibility[. != ''] or skills[. != '']">
                <xsl:when test="responsibility[. != '']">
                  <span class="psrch-PropLabel">
                    <xsl:text>Responsibilities: </xsl:text>
                  <span class="psrch-PropValue">
                    <xsl:value-of select="translate(responsibility,';',',')"/>
                    <xsl:text> </xsl:text>
                <xsl:when test="skills[. != '']">
                  <xsl:if test="responsibility[. != ''] and skills[. != '']">
                  <span class="psrch-PropLabel">
                    <xsl:text>Skills: </xsl:text>
                  <span class="psrch-PropValue">
                    <xsl:value-of select="translate(skills,';',',')"/>
            <xsl:otherwise><span /></xsl:otherwise>

RSSIf you like this post then please consider subscribing to my full feed RSS. You can also subscribe by Email and have new posts sent directly to your inbox.

11 Responses

  1. Adrian

    I made the same thing a few months ago:look here

    Because I already made a few experiences with XSLT as Microsoft BizTalk Developer I wrote/modified the XSLT directly in a Text-Editor.

    …and now: until now I havn’t wrote about this (or similar things). My blog contains till now just private things. But I think about to add content about SharePoint, BizTalk and generic C# experiences ;-)

  2. Links (9/1/2008) « Steve Pietrek - Everything SharePoint

    [...] Customize the People Search Results – Part 1 [...]

  3. Customize the People Search Results - Part 2 | Sharepointology

    [...] Customize the People Search Results – Part 1 we learned how to pimp the search results from looking something like [...]

  4. Anthony

    Nice post. You really helped me out here.

  5. Tom

    Great information! Very timely information for me.

  6. Sharepoint tips and tricks « Kevin's Blog

    [...] [...]

  7. Customizing People Search « Michaels Technology Soapbox

    [...] [...]

  8. Kişi Arama (People Search) Sonuç Özelleştirmesi | Evren Ayan - Blog

    [...] [...]

  9. James

    The preperation part does not explain to me clearly where I should be adding my end result so I can test it?

  10. Khushi

    Hi there, I tried to do this in SharePoint 2010. I couldn’t do it. I did able to add New ASPX page but was not able to bind DataView with XML file.
    Is there any other way to do it in SP2010

  11. Lerma

    Great article, easy to follow and worked great. Thanks!

Leave a Comment


My name is Erwin Bastiaensen and I am a Software Architect from Belgium, with a huge interest in technology. Lately I have been involved in some Java projects and implementing, interfacing and extending a Sharepoint portal.

You can contact me at sharepointology[@]

View Erwin Bastiaensen's profile on LinkedIn