Freitag, 14. Mai 2010

Search core results XSLT Sharepoint

Das Webpart search core results ist ziemlich eindrucksvoll, vor allem, da man wirklich einfach Resultate anzeigen kann. Wenn man gerne die Total Results zeigen will, kann man im XSLT folgende Variable eingeben und verwenden:
<xsl:variable name="Rows" select="/All_Results/Result" />
<xsl:variable name="RowCount" select="count($Rows)" />
<xsl:value-of select="$RowCount" />


Anbei noch eine Darstellung des Search Result XML:
<All_Results>
<Result>
<id>1</id>
<rank>713</rank>
<title>Microsoft.SharePoint Namespace</title>
<author />
<size>39058</size>
<url>http://msdn.microsoft.com/library/default.asp?url=/library/en- us/spptsdk/html/tsnsMicrosoftSharePoint_SV01017995.asp</url>
<description>Microsoft.SharePoint Namespace</description>
<sitename> http://msdn.microsoft.com/library</sitename>
<collapsingstatus>0</collapsingstatus>
<hithighlightedsummary>
<…>
</hithighlightedsummary>
<hithighlightedproperties>
<…>
</hithighlightedproperties>
<…>
</Result>
<Result>
<…>
<…>
</Result>
</All_Results>


The webpart called search core results is very impressive, especially, when you want to display results simply. If you want to display the total results, then you can use this code in your XSLT file:
<xsl:variable name="Rows" select="/All_Results/Result" />
<xsl:variable name="RowCount" select="count($Rows)" />
<xsl:value-of select="$RowCount" />


Here is the structure of the search-result XML:
<All_Results>
<Result>
<id>1</id>
<rank>713</rank>
<title>Microsoft.SharePoint Namespace</title>
<author />
<size>39058</size>
<url>http://msdn.microsoft.com/library/default.asp?url=/library/en- us/spptsdk/html/tsnsMicrosoftSharePoint_SV01017995.asp</url>
<description>Microsoft.SharePoint Namespace</description>
<sitename> http://msdn.microsoft.com/library</sitename>
<collapsingstatus>0</collapsingstatus>
<hithighlightedsummary>
<…>
</hithighlightedsummary>
<hithighlightedproperties>
<…>
</hithighlightedproperties>
<…>
</Result>
<Result>
<…>
<…>
</Result>
</All_Results>

Keine Kommentare:

Kommentar veröffentlichen