Creating a Tag Cloud in SharePoint

What you need

*Download, install and activate the Metadata Webpart from Codeplex

Note* I had to download the solution and make some slight modifications before I managed to get it to work. See here.

Solution

Activate the feature for the webpart at the site collection level.

Add the webpart to the page containing your list.

Modify the webpart properties to point to the correct list and field.

Modify the XSL String to the following:

<?xml version=’1.0′ encoding=’utf-8′?>

<xsl:stylesheet version=’1.0′ xmlns:xsl=’http://www.w3.org/1999/XSL/Transform’ xmlns:msxsl=’urn:schemas-microsoft-com:xslt’ exclude-result-prefixes=’msxsl’>

<xsl:output method=’html’ indent=’yes’/> <xsl:template name=’terms’ match=’//termset’>

<xsl:param name=’d’/> <div class=’termset’ style=’padding: 10px 0px; text-align: center;’>

<xsl:variable name=’AvgHit’><xsl:value-of select=’sum(//term/itemcount) div count(//term[itemcount > 0])’/>

</xsl:variable>

<xsl:for-each select=’//term[itemcount > 0]’>

<xsl:sort select=’name’/>

<xsl:element name=’span’>

<xsl:attribute name=’style’> padding-right: 5px; vertical-align: middle; padding-left: 5px;

<xsl:if test=’itemcount > $AvgHit’>font-size:1.5em;</xsl:if>

</xsl:attribute>

<xsl:element name=’a’>

<xsl:attribute name=’href’>?FilterField1=Wiki_x0020_Page_x0020_Categories&amp;FilterValue1=<xsl:value-of select=’name’/></xsl:attribute>

<xsl:value-of select=’name’/>

</xsl:element>

</xsl:element>

<xsl:if test=’position() != last()’>

<span style=”font-size: 90%; color:#ccc; vertical-align:middle;”> | </span> </xsl:if>

</xsl:for-each>

</div>

</xsl:template>

</xsl:stylesheet>

Modify the field name to match the one you want (in red bold).

Save all webpart settings.

Your tag cloud should look something like this:

When you click on each on the tags, your page will refresh with the list items that correspond to that tag. Note, this will only work if the list view webpart and tag cloud are on the same page.

Tags: ,

No comments yet.

Leave a Reply

%d bloggers like this: