Modify core search results to display custom property
-
06-12-2019 - |
Question
I am trying to modify the core search results webpart in SP2010. Ive created a managed property named: ExternalContactsCompany
I then added a <Column name="ExternalContactsCompany"/>
section to the fetched properties inside the webpart properties.
Next i added the following XSL:
TEST <xsl:value-of select="externalcontactscompany"/>
All i can see is "TEST". The last part is not showing anything.
And yes, the column is filled !
La solution
Replace your XSLT with the following piece of code (don't forget to backup ;))
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xmp><xsl:copy-of select="*"/></xmp>
</xsl:template>
</xsl:stylesheet>
Publish the page and verify which XML is available from the search engine. If the column "ExternalContactsCompany" is not available - you do something wrong.
Autres conseils
I wrote in my blog a guide to create a new crawlable property and a guide to modify the xsl that display the results list: http://salvatoredifaziosharepoint.blogspot.it/2012/04/how-to-modify-sharepoints-result-page.html