Pages

Wednesday, 13 July 2011

Showing search results in xml

Some time we need to cutomize search results via XSLT. To customize the search results, we need to display the results in xml.

Here is the xsl you can use in xsl property of search result core webpart to show the results in xml:

<?xml version="1.0" encoding="UTF-8"?>
<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>

once you apply the property, you need to research to get the results in xml and write your XSL according to given xml to customize the search result page.

Enjoy customizing search results :)