SharePoint 2010 Enterprise People Search – Alphabetize by last name

The Problem:

Several blogs out there complain about the search order which SharePoint returns people results. By default SharePoint Enterprise People Search displays preferred name ([Lastname], [First]) but alphabetizes by first name. Who thought that was a good idea?

The Solution:

Update your XSLT. First, make sure you understand that updating your XSLT will only alphabetized the results returned for that page.What this means is, if your webpart only shows ten results at a time, only those ten results will be alphabetized, not the entire search results for that query. To get around this, I always up the number of results to the out of the box maximum and use specific queries like “Office:Boston” to get a subset that can actually be sorted. I’ll talk about this more in an upcoming post, “SharePoint Search: Creating an OOTB people directory”.

Alright, to alphabetize your search results:

A. Open webpart properties of the People Search or Core Results webpart (it’ll work on either).

B. Set the maximum number of results per page to 50. This way we’ll actually get a decent set of data to sort.

C. Uncheck “Use Location Visualization”

D. Add “<Column Name=”LastName”/>” to the end of “Fetched Columns (before the </Columns> tag).

E. Update your XLST by finding “<xsl:for-each select=”All_Results/Results” and inject <xsl:sort select=”lastname”/> immediately after it (see image below).

I’ve included the full XLST for updating a default People Core Search container to sort by last name below the conclusion.

Conclusion:

I know, I know, this is much easier to fix in FAST, but for Enterprise Search this works well without needing custom dev. I’ve used this on office pages within SharePoint with great results. When the client wants more than 50 persons shown, I just use two people results webparts with very specific queries. For instance, I’ll have a people results box for A through M and a people results box for N through Z. With a little CSS magic it looks like one long people result box.

I hope this helped!

Attachments:

Default fetched properties with added lastname property:

<Columns>  <Column Name="WorkId"/>  <Column Name="UserProfile_GUID"/>  <Column Name="AccountName"/>  <Column Name="PreferredName" HitHighLight="true"/>  <Column Name="YomiDisplayName" HitHighLight="true"/>  <Column Name="JobTitle" HitHighLight="true"/>  <Column Name="Department" HitHighLight="true"/>  <Column Name="WorkPhone" HitHighLight="true"/>  <Column Name="OfficeNumber" HitHighLight="true"/>  <Column Name="PictureURL"/>  <Column Name="HierarchyUrl"/>  <Column Name="WorkEmail" HitHighLight="true"/>  <Column Name="Path"/>  <Column Name="HitHighlightedSummary"/>  <Column Name="HitHighlightedProperties"/>  <Column Name="Responsibility" HitHighLight="true"/>  <Column Name="Skills" HitHighLight="true"/>  <Column Name="SipAddress" HitHighLight="true"/>  <Column Name="Schools" HitHighLight="true"/>  <Column Name="PastProjects" HitHighLight="true"/>  <Column Name="Interests" HitHighLight="true"/>   <Column Name="OrgNames" HitHighLight="true"/>  <Column Name="OrgUrls"/>  <Column Name="OrgParentNames" HitHighLight="true"/>  <Column Name="OrgParentUrls"/>  <Column Name="Memberships" HitHighLight="true"/>  <Column Name="AboutMe" HitHighLight="true"/>  <Column Name="BaseOfficeLocation" HitHighLight="true"/>  <Column Name="ServiceApplicationID"/>  <Column Name="SocialDistance"/><Column Name="LastName"/></Columns>

 XLST for updating a default People Core Search container to sort by last name

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:SEARCHWC="http://schemas.microsoft.com/searchserver/"> <xsl:output method="xml" indent="no"/> <xsl:param name="SortBy" /> <xsl:param name="DropDownOption" /> <xsl:param name="RelevanceSortUrl" /> <xsl:param name="RelevanceSortLabel" /> <xsl:param name="SocialDistanceSortUrl" /> <xsl:param name="SocialDistanceSortLabel" /> <xsl:param name="NameSortUrl" /> <xsl:param name="NameSortLabel" /> <xsl:param name="IsNoKeyword" /> <xsl:param name="IsFixedQuery" /> <xsl:param name="ShowMoreLink" /> <xsl:param name="MoreLinkLabel" /> <xsl:param name="MoreLink" /> <xsl:param name="AlertMeLink" /> <xsl:param name="AlertMeText" /> <xsl:param name="SrchRSSText" /> <xsl:param name="SrchRSSLink" /> <xsl:param name="ShowMessage" /> <xsl:param name="ShowActionLinks" /> <xsl:param name="SearchProviderText" /> <xsl:param name="SearchProviderLink" /> <xsl:param name="IsPeopleCoreResultsWebPart" /> <xsl:param name="NoFixedQuery" /> <xsl:param name="NoKeyword" /> <xsl:param name="NoPeopleResults" /> <xsl:param name="NoPeopleResults1" /> <xsl:param name="NoPeopleResults2" /> <xsl:param name="NoPeopleResults3" /> <xsl:param name="NoPeopleResults4" /> <xsl:param name="ParentOrgsLabel" /> <xsl:param name="ViewHiearchyLabel" /> <xsl:param name="RecentContentLabel" /> <xsl:param name="ResponsibilitiesLabel" /> <xsl:param name="SkillsLabel" /> <xsl:param name="InterestsLabel" /> <xsl:param name="PastProjectsLabel" /> <xsl:param name="SchoolLabel" /> <xsl:param name="MembershipLabel" /> <xsl:param name="AboutMeLabel" /> <xsl:param name="BaseOfficeLabel" /> <xsl:param name="SummaryLabel" /> <xsl:param name="ProfileViewLabel" /> <xsl:param name="UpdateProfileLabel" /> <xsl:param name="QueriesFoundYouLabel" /> <xsl:param name="UpdateProfileKeywordLabel" /> <xsl:param name="SelfSearchLabel" /> <xsl:param name="NoKeywordLabel" /> <xsl:param name="AddToMyColleaguesText" /> <xsl:param name="PopupFetcingResultLabel" /> <xsl:param name="IdPrefix" /> <xsl:param name="LangPickerHeading" /> <xsl:param name="LangPickerNodeSet" /> <xsl:param name="FilterNodeSet" /> <xsl:param name="ShowPeopleSortDropdown" /> <xsl:param name="RecentUpdateTabLabel" />

<!-- When there is no keywory to issue the search --> <xsl:template name="dvt_1.noKeyword">   <span>     <xsl:choose>       <xsl:when test="$IsFixedQuery">         <xsl:value-of select="$NoFixedQuery" />       </xsl:when>       <xsl:otherwise>         <xsl:value-of select="$NoKeyword" />       </xsl:otherwise>     </xsl:choose>   </span>       </xsl:template>

<!-- When empty result set is returned from search --> <xsl:template name="dvt_1.empty">    <div>     <xsl:if test="$ShowActionLinks">       <xsl:call-template name="ActionBarTemplate" />     </xsl:if>   </div>

  <span id="CSR_NO_RESULTS">     <xsl:value-of select="$NoPeopleResults"/>     <ol>       <li><xsl:value-of select="$NoPeopleResults1"/></li>       <li><xsl:value-of select="$NoPeopleResults2"/></li>       <li><xsl:value-of select="$NoPeopleResults3"/></li>       <li><xsl:value-of select="$NoPeopleResults4"/></li>     </ol>   </span> </xsl:template>

<!-- Main body template--> <xsl:template name="dvt_1.body">   <div>     <xsl:if test="$ShowActionLinks">       <div>         <xsl:if test="$LangPickerNodeSet and count($LangPickerNodeSet) &gt; 0">           <label for="langpickerdd" id="langpickerddlabel"><xsl:value-of select="$LangPickerHeading"/></label>           <select title="{$LangPickerHeading}" onchange="window.location.href=this.value" id="langpickerdd">             <xsl:for-each select="$LangPickerNodeSet">               <xsl:element name="option">                 <xsl:attribute name="value"><xsl:value-of select="@url"/></xsl:attribute>                 <xsl:if test="@selected = 'true'">                   <xsl:attribute name="selected">selected</xsl:attribute>                 </xsl:if>                 <xsl:value-of select="@title"/>               </xsl:element>             </xsl:for-each>                  </select>           <xsl:text disable-output-escaping="yes">&#8195;</xsl:text>         </xsl:if>

        <xsl:if test="$ShowPeopleSortDropdown">           <label for="sortbydd" id="sortbyddlabel"><xsl:value-of select="$SortBy" /></label>           <select title="{$SortBy}" name="dropdown" onchange="window.location.href=this.value" id="sortbydd">             <xsl:element name="option">               <xsl:attribute name="value"><xsl:value-of select="ddwrt:EnsureAllowedProtocol(string($RelevanceSortUrl))"/></xsl:attribute>               <xsl:if test="$DropDownOption = '0'">                 <xsl:attribute name="selected">selected</xsl:attribute>               </xsl:if>               <xsl:value-of select="$RelevanceSortLabel"/>             </xsl:element>             <xsl:if test="string-length($SocialDistanceSortUrl) &gt; 0 and string-length($SocialDistanceSortLabel) &gt; 0">               <xsl:element name="option">                 <xsl:attribute name="value"><xsl:value-of select="ddwrt:EnsureAllowedProtocol(string($SocialDistanceSortUrl))"/></xsl:attribute>                 <xsl:if test="$DropDownOption = '1'">                   <xsl:attribute name="selected">selected</xsl:attribute>                 </xsl:if>                 <xsl:value-of select="$SocialDistanceSortLabel"/>               </xsl:element>             </xsl:if>             <xsl:element name="option">               <xsl:attribute name="value"><xsl:value-of select="ddwrt:EnsureAllowedProtocol(string($NameSortUrl))"/></xsl:attribute>               <xsl:if test="$DropDownOption = '2'">                 <xsl:attribute name="selected">selected</xsl:attribute>               </xsl:if>               <xsl:value-of select="$NameSortLabel"/>             </xsl:element>           </select>            <xsl:text disable-output-escaping="yes">&#8195;</xsl:text>         </xsl:if>

        <xsl:call-template name="ActionBarTemplate" />       </div>     </xsl:if>     <xsl:for-each select="All_Results/Result">       <xsl:sort select="lastname"/>       <xsl:call-template name="SingleResult"/>     </xsl:for-each>        <xsl:call-template name="MoreLinkTemplate" />   </div>  </xsl:template>

<!-- This template is called for each result --> <xsl:template name="SingleResult">    <xsl:element name="div">     <xsl:attribute name="id">       <xsl:value-of select="concat('Container', id)"/>     </xsl:attribute>     <xsl:choose>       <xsl:when test="id = 1">         <xsl:attribute name="class">psrch-FirstFullResult</xsl:attribute>       </xsl:when>       <xsl:otherwise>         <xsl:attribute name="class">psrch-FullResult</xsl:attribute>       </xsl:otherwise>     </xsl:choose>     <xsl:call-template name="SingleResultInternal" />   </xsl:element> </xsl:template>

<xsl:template name="SingleResultInternal">   <xsl:variable name="id" select="id"/>   <xsl:variable name="currentId" select="concat($IdPrefix,$id)"/>   <xsl:variable name="url" select="url"/>   <xsl:variable name="email" select="workemail"/>   <xsl:variable name="sip" select="sipaddress"/>   <xsl:variable name="prefix">IMNRC('</xsl:variable>   <xsl:variable name="suffix">')</xsl:variable>

  <xsl:variable name="hassip"       select="string-length($sip) &gt; 0"/>   <xsl:variable name="hasemail"     select="string-length($email) &gt; 0"/>   <xsl:variable name="haspn"        select="string-length(preferredname) &gt; 0"/>   <xsl:variable name="hasydn"       select="string-length(yomidisplayname) &gt; 0"/>   <xsl:variable name="hasjt"        select="string-length(jobtitle) &gt; 0"/>   <xsl:variable name="hasdp"        select="string-length(department) &gt; 0"/>   <xsl:variable name="hasorg"       select="string-length(orgnames) &gt; 0"/>   <xsl:variable name="haswph"       select="string-length(workphone) &gt; 0"/>   <xsl:variable name="hasonum"      select="string-length(officenumber) &gt; 0"/>

  <xsl:variable name="hascol"       select="string-length(colleaguecategory) &gt; 0"/>   <xsl:variable name="hasacu"       select="string-length(addtomycolleaguesurl) &gt; 0"/>   <xsl:variable name="hashier"      select="string-length(hierarchyurl) &gt; 0"/>

  <xsl:variable name="hasabme"      select="string-length(aboutme) &gt; 0"/>   <xsl:variable name="hasresp"      select="string-length(responsibility) &gt; 0"/>   <xsl:variable name="hassk"        select="($FilterNodeSet and $FilterNodeSet/@title='SPShSkills') or hithighlightedproperties/skills/@hashh &gt; 0"/>   <xsl:variable name="hasint"       select="($FilterNodeSet and $FilterNodeSet/@title='SPShInterests') or hithighlightedproperties/interests/@hashh &gt; 0"/>   <xsl:variable name="hasorgparent" select="($FilterNodeSet and $FilterNodeSet/@title='OrgParentNames') or hithighlightedproperties/orgparentnames/@hashh &gt; 0"/>   <xsl:variable name="hasmem"       select="($FilterNodeSet and $FilterNodeSet/@title='Memberships') or hithighlightedproperties/memberships/@hashh &gt; 0"/>   <xsl:variable name="haspp"        select="($FilterNodeSet and $FilterNodeSet/@title='SPShPastProjects') or hithighlightedproperties/pastprojects/@hashh &gt; 0"/>   <xsl:variable name="hasbol"       select="($FilterNodeSet and $FilterNodeSet/@title='SPShLocation') or hithighlightedproperties/baseofficelocation/@hashh &gt; 0"/>   <xsl:variable name="hassch"       select="($FilterNodeSet and $FilterNodeSet/@title='SPShSchool') or hithighlightedproperties/schools/@hashh &gt; 0"/>   <xsl:variable name="hassum"       select="count(hithighlightedsummary/c0) &gt; 0"/>

  <xsl:variable name="hasvlm"       select="string-length(profileviewlastmonth) &gt; 0"/>   <xsl:variable name="hasvlw"       select="string-length(profileviewlastweek) &gt; 0"/>   <xsl:variable name="hasquery"     select="string-length(queriesfoundyou) &gt; 0"/>       <div id="UserPhoto">     <a href="{ddwrt:EnsureAllowedProtocol(string($url))}" id="{concat($currentId, '_CSR_IMGL')}" title="{preferredname}">       <xsl:variable name="imgid" select="concat('CSR_IMG_',$id)"/>       <xsl:variable name="purl">         <xsl:call-template name="GetPicUrl">           <xsl:with-param name="PicUrl" select="pictureurl"/>           <xsl:with-param name="PlaceHolderUrl" select="'/_layouts/images/o14_person_placeholder_96.png'"/>         </xsl:call-template>       </xsl:variable>       <img id="{$imgid}" src="{ddwrt:EnsureAllowedProtocol(string($purl))}" alt="{preferredname}" border="0"></img>     </a>     <xsl:if test="$hascol">       <div id="ColleagueField">         <xsl:value-of select="colleaguecategory"/>       </div>     </xsl:if>   </div>   <span id="JBean">     <xsl:choose>       <xsl:when test="$hassip">         <img alt="" border="0" height="12" width="12" src="/_layouts/images/imnhdr.gif" onload="{concat($prefix, $sip, $suffix)}" ShowOfflinePawn="1" id="{concat('CSRP_',$id,',type=sip')}" />       </xsl:when>       <xsl:otherwise>         <img alt="" border="0" height="12" width="12" src="/_layouts/images/imnhdr.gif" onload="{concat($prefix, $email, $suffix)}" ShowOfflinePawn="1" id="{concat('CSRP_',$id,',type=smtp')}" />       </xsl:otherwise>     </xsl:choose>   </span>   <div id="ContactInfo">     <ul id="MiniContactCard">       <li id="NameField">         <xsl:if test="$haspn">           <a href="{ddwrt:EnsureAllowedProtocol(string($url))}" id="{concat($currentId, '_CSR')}">             <xsl:apply-templates select="hithighlightedproperties/preferredname" />           </a>         </xsl:if>       </li>       <xsl:if test="$hasydn">         <li id="YomiField">           <xsl:apply-templates select="hithighlightedproperties/yomidisplayname" />         </li>       </xsl:if>       <xsl:if test="$hasjt">         <li id="JobTitleField">           <xsl:apply-templates select="hithighlightedproperties/jobtitle" />         </li>       </xsl:if>       <xsl:if test="$hasdp and not($hasorg)">         <li id="DepartmentField">           <xsl:apply-templates select="hithighlightedproperties/department" />         </li>       </xsl:if>       <xsl:if test="$hasorg">         <li id="OrgField">                              <xsl:call-template name="RenderNameUrlMultivalue">             <xsl:with-param name="names" select="hithighlightedproperties/orgnames"/>             <xsl:with-param name="urls" select="orgurls_multival"/>             <xsl:with-param name="currentId" select="$currentId"/>           </xsl:call-template>                  </li>       </xsl:if>       <xsl:if test="$haswph">         <li id="PhoneField">           <xsl:apply-templates select="hithighlightedproperties/workphone" />         </li>       </xsl:if>       <xsl:if test="$hasonum">         <li id="OfficeField">           <xsl:apply-templates select="hithighlightedproperties/officenumber" />         </li>       </xsl:if>       <xsl:if test="$hassip or $hasemail">         <li id="EmailField">           <xsl:choose>             <xsl:when test="$hassip">               <a id="{concat($currentId, '_EmailLink')}" href="{concat('mailto:', $sip)}">                 <xsl:apply-templates select="hithighlightedproperties/sipaddress" />               </a>             </xsl:when>             <xsl:otherwise>               <a id="{concat($currentId, '_EmailLink')}" href="{concat('mailto:', $email)}">                 <xsl:apply-templates select="hithighlightedproperties/workemail" />               </a>             </xsl:otherwise>           </xsl:choose>         </li>       </xsl:if>     </ul>

    <xsl:if test="$hasacu or $hashier or $IsPeopleCoreResultsWebPart">       <ul id="Actions">                <xsl:if test="$hasacu">           <li id="AddColleagueLinkField">             <a id="{concat($currentId, '_AddColleagueLink')}" href="{ddwrt:EnsureAllowedProtocol(string(addtomycolleaguesurl))}">&#187; <xsl:value-of select="$AddToMyColleaguesText" /></a>           </li>         </xsl:if>         <xsl:if test="$hashier">           <li id="OrgBrowserField">             <a id="{concat($currentId, '_OrgBrowserLink')}" href="{ddwrt:EnsureAllowedProtocol(string(hierarchyurl))}">&#187; <xsl:value-of select="$ViewHiearchyLabel" /></a>           </li>         </xsl:if>         <xsl:if test="$IsPeopleCoreResultsWebPart">           <li id="RecentContentField">             <a href="javascript:" ID="{concat('recentcontentlink_',$id)}" runat="server" PreferredName="{preferredname}">                 <xsl:value-of select="concat('&#187; ', substring-before($RecentContentLabel, '{0}'), preferredname, substring-after($RecentContentLabel, '{0}'))"/>             </a>             <SEARCHWC:PopupControlExtender ID="{concat('popupextender_',$id)}" runat="server"             TargetControlID="{concat('recentcontentlink_',$id)}"             PopupControlID="PopupPanelPeopleCore"             PopupShowingScript="{concat('PostbackUserName(this.get_element(),this._popupElement,&quot;',$RecentUpdateTabLabel,'&quot;)')}"             PopupHiddenScript=""             HoverDelay="500"             UnhoverDelay="500"/>           </li>         </xsl:if>       </ul>     </xsl:if>   </div>

  <xsl:if test="$hasabme or $hasresp or $hassk or $hasint or $hasorgparent or $hasmem or $haspp or $hassch or $hasbol or $hassum">     <div id="MoreInfo">       <ul>                <xsl:if test="$hasabme">           <li>             <span id="FieldTitle">               <xsl:value-of select="$AboutMeLabel" />             </span>             <xsl:apply-templates select="hithighlightedproperties/aboutme" />           </li>         </xsl:if>         <xsl:if test="$hasresp">           <li>             <span id="FieldTitle">               <xsl:value-of select="$ResponsibilitiesLabel" />             </span>                      <xsl:call-template name="RenderSimpleMultivalue">               <xsl:with-param name="multivalue" select="hithighlightedproperties/responsibility"/>               <xsl:with-param name="cutoff" select="5"/>             </xsl:call-template>           </li>         </xsl:if>         <xsl:if test="$hassk">           <li>             <span id="FieldTitle">               <xsl:value-of select="$SkillsLabel" />             </span>                      <xsl:call-template name="RenderSimpleMultivalue">               <xsl:with-param name="multivalue" select="hithighlightedproperties/skills"/>               <xsl:with-param name="cutoff" select="5"/>             </xsl:call-template>           </li>         </xsl:if>         <xsl:if test="$hasint">           <li>             <span id="FieldTitle">               <xsl:value-of select="$InterestsLabel" />             </span>                      <xsl:call-template name="RenderSimpleMultivalue">               <xsl:with-param name="multivalue" select="hithighlightedproperties/interests"/>               <xsl:with-param name="cutoff" select="5"/>             </xsl:call-template>           </li>         </xsl:if>         <xsl:if test="$hasorgparent">           <li>                        <span id="FieldTitle">               <xsl:value-of select="$ParentOrgsLabel" />             </span>                      <span id="HotHH">               <xsl:call-template name="RenderNameUrlMultivalue">                 <xsl:with-param name="names" select="hithighlightedproperties/orgparentnames"/>                 <xsl:with-param name="urls" select="orgparenturls_multival"/>                 <xsl:with-param name="currentId" select="$currentId"/>               </xsl:call-template>             </span>           </li>         </xsl:if>         <xsl:if test="$hasmem">           <li>             <span id="FieldTitle">               <xsl:value-of select="$MembershipLabel" />             </span>                      <xsl:call-template name="RenderSimpleMultivalue">               <xsl:with-param name="multivalue" select="hithighlightedproperties/memberships"/>               <xsl:with-param name="cutoff" select="5"/>             </xsl:call-template>           </li>         </xsl:if>         <xsl:if test="$haspp">           <li>             <span id="FieldTitle">               <xsl:value-of select="$PastProjectsLabel" />             </span>                      <xsl:call-template name="RenderSimpleMultivalue">               <xsl:with-param name="multivalue" select="hithighlightedproperties/pastprojects"/>               <xsl:with-param name="cutoff" select="5"/>             </xsl:call-template>           </li>         </xsl:if>         <xsl:if test="$hassch">           <li>             <span id="FieldTitle">               <xsl:value-of select="$SchoolLabel" />             </span>                      <xsl:call-template name="RenderSimpleMultivalue">               <xsl:with-param name="multivalue" select="hithighlightedproperties/schools"/>               <xsl:with-param name="cutoff" select="5"/>             </xsl:call-template>           </li>         </xsl:if>         <xsl:if test="$hasbol">           <li>             <span id="FieldTitle">               <xsl:value-of select="$BaseOfficeLabel" />             </span>                      <xsl:apply-templates select="hithighlightedproperties/baseofficelocation" />           </li>         </xsl:if>         <xsl:if test="$hassum">           <li>             <span id="FieldTitle">               <xsl:value-of select="$SummaryLabel" />             </span>             <xsl:apply-templates select="hithighlightedsummary" />           </li>         </xsl:if>       </ul>     </div>   </xsl:if>

  <div id="Clear">     <img src='/_layouts/images/blank.gif' alt=''/>   </div>

  <xsl:if test="$hasvlm or $hasvlw or $hasquery">     <div id="SelfSrchHeading">       <table cellspacing="0" cellpadding="0">         <tr>           <td>             <xsl:value-of select="$SelfSearchLabel" />           </td>         </tr>       </table>     </div>

    <div id="SelfSrchFreq">       <a id="{concat($currentId, '_EditProfileLink')}" href="{ddwrt:EnsureAllowedProtocol(string(editprofileurl))}"><xsl:value-of select="$UpdateProfileLabel" /></a>       <div id="SelfSrchFreqTitle">           <xsl:value-of select="$ProfileViewLabel" />       </div>            <xsl:if test="$hasvlm and $hasvlw">         <ul>           <li>             <xsl:value-of disable-output-escaping="yes" select="profileviewlastmonth"/>           </li>           <li>             <xsl:value-of disable-output-escaping="yes" select="profileviewlastweek"/>           </li>         </ul>       </xsl:if>     </div>

    <div id="SelfSrchTerms">       <a id="{concat($currentId, '_UpdateKeywordsLink')}" href="{ddwrt:EnsureAllowedProtocol(string(updatekeywordsurl))}"><xsl:value-of select="$UpdateProfileKeywordLabel" /></a>       <div id="SelfSrchTermsTitle">         <xsl:value-of select="$QueriesFoundYouLabel" />       </div>       <div id="SelfSrchTermsContent">         <xsl:choose>           <xsl:when test="$hasquery">             <xsl:call-template name="RenderSimpleMultivalue">               <xsl:with-param name="multivalue" select="queriesfoundyou_multival"/>               <xsl:with-param name="cutoff" select="5"/>             </xsl:call-template>           </xsl:when>           <xsl:otherwise>             <xsl:value-of select="$NoKeywordLabel" />           </xsl:otherwise>         </xsl:choose>       </div>     </div>

    <div id="Clear2">       <img src='/_layouts/images/blank.gif' alt=''/>     </div>   </xsl:if> </xsl:template> 

<!-- XSL transformation starts here --> <xsl:template match="/">   <xsl:if test="$AlertMeLink and $ShowActionLinks">     <input type="hidden" name="P_Query" />    <input type="hidden" name="P_LastNotificationTime" />   </xsl:if>

  <div>     <xsl:choose>       <xsl:when test="$IsNoKeyword = 'True'" >         <xsl:call-template name="dvt_1.noKeyword" />       </xsl:when>       <xsl:when test="$ShowMessage = 'True'">         <xsl:call-template name="dvt_1.empty" />       </xsl:when>       <xsl:otherwise>         <xsl:call-template name="dvt_1.body"/>            </xsl:otherwise>     </xsl:choose>

    <xsl:if test="$IsPeopleCoreResultsWebPart and (count(All_Results/Result) &gt; 0 or count(All_Results/FakeResult) &gt; 0)">       <asp:Panel ID="PopupPanelPeopleCore" runat="server" CssClass="psrch-PopupPanel">                        <div id="PopupContainer">                    <asp:UpdatePanel runat="server" ID="UpdatePanelPeopleCore" UpdateMode="Conditional" ChildrenAsTriggers="true">             <ContentTemplate>                            <SEARCHWC:PeopleCoreResultPopupControl                 id="PopupControl51A944753DF0430C8FE1EBAA70F3E945"                 runat="server"/>                           <div id="PopupFooter">                 <asp:UpdateProgress ID="UpdateProgress" DisplayAfter="0" AssociatedUpdatePanelID="UpdatePanelPeopleCore" runat="server">                   <ProgressTemplate>                     <span id="Progress">                       <img src="/_layouts/images/hig_progcircle_loading24.gif"/>                       <xsl:value-of select="$PopupFetcingResultLabel" />                     </span>                                    </ProgressTemplate>                 </asp:UpdateProgress>               </div>             </ContentTemplate>                      </asp:UpdatePanel>         </div>       </asp:Panel>     </xsl:if>  

  </div> </xsl:template>

<xsl:template name="ActionBarTemplate">   <xsl:if test="string-length($AlertMeLink) &gt; 0">      <a href="{$AlertMeLink}" id="CSR_AM" title="{$AlertMeText}">       <img src="/_layouts/images/bell.gif" alt="{$AlertMeText}" border="0"/>     </a>     <xsl:text disable-output-escaping="yes">&#8195;</xsl:text>   </xsl:if>

  <xsl:if test="string-length($SrchRSSLink) &gt; 0">         <a type="application/rss+xml" href="{ddwrt:EnsureAllowedProtocol(string($SrchRSSLink))}" title="{$SrchRSSText}" id="SRCHRSSL">       <img border="0" src="/_layouts/images/rss.gif" alt="{$SrchRSSText}"/>     </a>     <xsl:text disable-output-escaping="yes">&#8195;</xsl:text>   </xsl:if>

  <xsl:if test="string-length($SearchProviderLink) &gt; 0">      <a href="{ddwrt:EnsureAllowedProtocol(string($SearchProviderLink))}" title="{$SearchProviderText}" >       <img border="0" src="/_layouts/images/searchfolder.png" alt="{$SearchProviderText}"/>     </a>     <xsl:text disable-output-escaping="yes">&#8195;</xsl:text>   </xsl:if> </xsl:template>

<xsl:template name="GetPicUrl">   <xsl:param name="PicUrl"/>   <xsl:param name="PlaceHolderUrl"/>    <xsl:choose>     <xsl:when test="string-length($PicUrl) &lt; 1 or starts-with($PicUrl, 'file:') or starts-with($PicUrl, '\\') or starts-with($PicUrl, '//')">       <xsl:value-of select="$PlaceHolderUrl"/>     </xsl:when>     <xsl:otherwise>       <xsl:value-of select="$PicUrl"/>     </xsl:otherwise>   </xsl:choose> </xsl:template>

<xsl:template name="MoreLinkTemplate">   <xsl:if test="$ShowMoreLink = true() and string-length($MoreLink) &gt; 0">     <div id="MoreLink">       <a href="{ddwrt:EnsureAllowedProtocol(string($MoreLink))}">         <xsl:value-of select="$MoreLinkLabel"/>       </a>     </div>   </xsl:if> </xsl:template>

<xsl:template name="RenderNameUrlMultivalue">   <xsl:param name="names"/>   <xsl:param name="urls"/>   <xsl:param name="currentId"/>   <xsl:for-each select="$names">     <xsl:variable name="p" select="position()"/>     <xsl:if test="string-length(.) &gt; 0">       <xsl:if test="$p &gt; 1">         <span> :: </span>       </xsl:if>       <xsl:choose>         <xsl:when test="string-length($urls[$p]) &gt; 0">           <a id="{concat($currentId, '_MultivalueUrl')}" href="{ddwrt:EnsureAllowedProtocol(string($urls[$p]))}">             <xsl:apply-templates select="." />           </a>         </xsl:when>         <xsl:otherwise>           <xsl:apply-templates select="." />         </xsl:otherwise>       </xsl:choose>     </xsl:if>          </xsl:for-each> </xsl:template>

<xsl:template name="RenderSimpleMultivalue">   <xsl:param name="multivalue"/>   <xsl:param name="cutoff"/>   <xsl:for-each select="$multivalue">     <xsl:sort data-type="number" order="descending" select="@hashh"/>     <xsl:variable name="p" select="position()"/>     <xsl:if test="string-length(.) &gt; 0">       <xsl:choose>         <xsl:when test="$p = 1">           <span id="Multivalue">             <xsl:apply-templates select="." />           </span>         </xsl:when>         <xsl:when test="$p &gt; 1 and $p &lt;= $cutoff">           <span> :: </span>           <span id="Multivalue"><xsl:apply-templates select="." /></span>         </xsl:when>         <xsl:when test="$p = $cutoff + 1">           &#8230;         </xsl:when>       </xsl:choose>     </xsl:if>   </xsl:for-each> </xsl:template>

<xsl:template name="HitHighlighting">  <xsl:param name="hh" />  <xsl:apply-templates select="$hh"/> </xsl:template>

<xsl:template match="ddd">   &#8230;  </xsl:template> <xsl:template match="c0">     <b><xsl:value-of select="."/></b> </xsl:template> <xsl:template match="c1">     <b><xsl:value-of select="."/></b> </xsl:template> <xsl:template match="c2">     <b><xsl:value-of select="."/></b> </xsl:template> <xsl:template match="c3">     <b><xsl:value-of select="."/></b> </xsl:template> <xsl:template match="c4">     <b><xsl:value-of select="."/></b> </xsl:template> <xsl:template match="c5">     <b><xsl:value-of select="."/></b> </xsl:template> <xsl:template match="c6">     <b><xsl:value-of select="."/></b> </xsl:template> <xsl:template match="c7">     <b><xsl:value-of select="."/></b> </xsl:template> <xsl:template match="c8">     <b><xsl:value-of select="."/></b> </xsl:template> <xsl:template match="c9">     <b><xsl:value-of select="."/></b> </xsl:template>

</xsl:stylesheet>

Leave a Reply