My new blog present here.

Featured Post

Insights into Sitecore Search: A Definitive Introduction

A key component of digital experience management is effective information retrieval. A simplified approach is required for websites, applications, and platforms containing a lot of material so that consumers can easily get the data they require. This need is met by Sitecore, a well-known name in the field of digital experience platforms (DXPs), which provides powerful and comprehensive search functionality. We will travel into the realm of Sitecore Search in this article, learning about its capabilities, architecture , and the enormous value it offers both developers and end users. Introduction to Sitecore Search    A headless content discovery platform powered by AI , Sitecore Search enables you to build predictive and custom search experiences across various content sources. To extract and index you

Customizing Search Results with Custom XSLTs in SharePoint Server 2007

Introduction

When users perform search queries by using Microsoft Office SharePoint Server 2007, the search results are rendered by the Search Core Results Web Part. The rendered HTML that users see is actually an XSLT transformation applied to the XML that contains the search results. If you want to change the color and layout of this page then below are the some tricks to apply these changes.

Background

First of all, we should understant that what is Search Core Results web parth. This web part is inbuild web part provided by the MS Office Sharepoint Sever 2007 for searching records in the sharepoint site. This web part contain the settings related to search scope,layout and etc.


Custom change in the XSLT file:

1. Open the sharepoint page in edit mode and add search core result web part.

2. In the Bottom Zone, in the Search Core Results Web Part, click edit, and then click Modify Shared Web Part.

3. In the Search Core Results tool pane, click XSL Editor. Create an empty XML file by using Microsoft Visual Studio 2005, and then copy all the XSLT into the XML file.









4. If you want to change the background color of searched text:











Search Code :

            //
// <xsl:template match="ddd">

Below are the tags that exist after above mentioned tag :

  <xsl:template match="c0">
<b><xsl:value-of select="."/></b>
</xsl:template>
<xsl:template match="c1">
<b><xsl:value-of select="."/></b>
</xsl:template>
The above mentioned tag exist from c0-c9. For displaying background color in searched text, you need to add the span tag above the "b" tag.
<xsl:template match="c0">
<span style="background-color:yellow">
<b><xsl:value-of select="."/></b>
</span>
</xsl:template>
<xsl:template match="c1">
<span style="background-color:yellow">
<b><xsl:value-of select="."/></b>
</span>
</xsl:template>

5. If you want to change the background color of page, spaces from top/bottom/left write and want to add line in the top/bottom of the search result page:






Search Code :

           //
//
<xsl:template name="dvt_1.body">
// in the XSLT file
//Add div tag below the above mentioned tag:

<div class="srch-results" style="background-color:#f0f0f0;border-top: #999 1px solid;border-bottom: #999 1px solid;padding-top:1px;padding-bottom:1px;padding-left:1px;padding-right:1px">



After doing these changes,save the xslt file then you will be ablt to see the above mentioned changes in your search result page.

Search results returned by the search engine are returned in XML format. The Search Core Results Web Part takes this XML as input and then applies an XSL transformation on the XML to render the HTML that users see on the search results page. This XSLT is public; it can be modified and replaced with custom XSLT to display results according to your requirements.


Comments

Popular posts from this blog

Sitecore GraphQL Queries

Sitecore Experience Edge GraphQL Queries

Configuring Sitecore Next.js Headless SXA Multisite App in a Sitecore Container