Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I would be grateful if someone can show me how I would rewrite the following XSL file to produce the following layout (I have removed the Parameter lines in the code to meet the max character requirements):

1 | 2

3 | 4

5 | 6

    <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"/>
    <!-- PARAMETER LINES REMOVED TO SHORTEN CODE TO ACCEPTED LENGTH -->

    <!-- When there is no keywory to issue the search -->
    <xsl:template name="dvt_1.noKeyword">
      <span class="ms-sbplain">
        <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 class="psrch-results">
        <xsl:if test="$ShowActionLinks">
          <xsl:call-template name="ActionBarTemplate" />
        </xsl:if>
      </div>

      <span class="srch-description" 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 class="psrch-results">
        <xsl:if test="$ShowActionLinks">
          <div class="srch-sort-right2"> 
            <xsl:if test="$LangPickerNodeSet and count($LangPickerNodeSet) &gt; 0">
              <label for="langpickerdd" id="langpickerddlabel"><xsl:value-of select="$LangPickerHeading"/></label>
              <select title="{$LangPickerHeading}" class="srch-dropdown" 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" class="srch-dropdown" 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: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>
          </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: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 class="psrch-Main">
        <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" class="psrch-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 class="psrch-UpdateGraphics" 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 class="psrch-TextSeparator"> :: </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 class="psrch-TextSeparator"> :: </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>
share|improve this question
    
You will have a much better chance of getting an answer if you can keep the question as short and direct as possible. See the FAQ for general guidelines. –  SPDoctor May 17 '13 at 16:45
    
Thanks for your advice, I have now stripped my question down to the bare minimum. –  Luke T May 21 '13 at 10:40
add comment

3 Answers

up vote 1 down vote accepted

I can't recall if the People Search XSL contains a Current Position parameter. But if it does, XSL has a method called mod which is commonly used to alternate item display.

Example:

...
<xsl:if test="position() mod 2 = 0">
    <!-- Your HTML for items -->
</xsl:if>
<xsl:if test="position() mod 2 = 1">
    <!-- Your HTML for alternating items -->
</xsl:if>
...

This way you can with the help of HTML and CSS change how to display the search results.

Hope this helps.

share|improve this answer
    
Thanks for your suggestion, I'll see if I can implement it. –  Luke T May 21 '13 at 13:21
    
Hi Daniel, I have tried to implement your code with some success, but I'm sure I'm positioning the code incorrectly. Can you show me where this code would sit within a simple table with two columns, each table cell holding a "SingleResult" template reference? Thanks for your help, I think I'm much closer to getting the results I need with your advice! :-) –  Luke T May 22 '13 at 10:21
add comment

with the use of your code, I was finally able to produce the formatting results I wanted. Below is the XSL I used:

    <xsl:for-each select="All_Results/Result">
         <xsl:if test="position() mod 2 = 1">
              <div style="width:50%;float:left;"><xsl:call-template name="SingleResult"/></div>
         </xsl:if>
         <xsl:if test="position() mod 2 = 0">
              <div style="width:50%;float:right;"><xsl:call-template name="SingleResult"/></div>            <div style="clear: both;"></div>
         </xsl:if>
    </xsl:for-each>

Thanks for your help! :-)

share|improve this answer
    
Glad I could help :) –  Daniel Ziga May 22 '13 at 11:05
add comment

Luke T-

How did you get this to work?

When I try this

    <xsl:for-each select="All_Results/Result">
         <xsl:if test="position() mod 2 = 1">
              <div style="width:50%;float:left;"><xsl:call-template name="SingleResult"/></div>
         </xsl:if>
         <xsl:if test="position() mod 2 = 0">
              <div style="width:50%;float:right;"><xsl:call-template name="SingleResult"/></div>            <div style="clear: both;"></div>
         </xsl:if>
    </xsl:for-each>

I end up with
1
    2
3
    4

share|improve this answer
    
this is not an answer, next time please use comments. –  Alex Choroshin Jun 13 '13 at 17:20
    
Hi Shawn, sorry for not replying earlier - I've been on holiday. Dave Paylor's answer on your 'redux' thread should work very nicely. The solution I ended up using was probably overkill. –  Luke T Jun 27 '13 at 9:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.