I’m in the process of reorganizing a Sharepoint 2010 site for our department, and one of the big changes is going from a folder based structure to a flat list of tagged and categorized documents.
In order to create a nice visual way of filtering the list, I’ve implemented a tag cloud using the managed metadata fields in the list. Here it is:

Now, Sharepoint’s built in Tag Cloud Webpart can only access Tags, not Managed Metadata columns. Tags are a no-go since they can’t be shown in list views, and you can’t have multiple sets of metadata. Managed Metadata on the other hand, is perfect for our situation.
So, in order to create the managed metadata tag cloud, I used the brilliant Sharepoint 2010 Managed Metadata WebPart from Brian JC. The web part takes as arguments a list, the column from which you want to display the metadata fields, and an XSL stylesheet to format the contents. And it’s free! (GPL license)
The default stylesheet produces the following output:
Now, in order to get it to display as a tag cloud, replace the default stylesheet with this XSL (swap METADATACOLUMNNAME with the actual column name in your list):
<?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=METADATACOLUMNNAME&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>
What it does:
- Ignores the metadata structure, listing all tags
- Removes tags that aren’t used in the list
- Increases the font size for all tags used in a higher than average number of items (the most popular tags)
- Adds a link to filter the given list using the chosen tag (Note: The list to be filtered must be on the same page as this web part)
