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)

Dear sir,
I am incorrect but does your xslt contains several errors? I see first a /pre tag than the pre tage. I see an attribute element that’s not closed and three div tags (meaning there must be one missing or one too many). Could you please correct the errors. I am interested in your solution.
Hey Pim,
Thanks for your feedback! You’re entirely right, it seems WordPress did a number on the code when i pasted it. I’ve reattached the XSL, hopefully without any errors this time :) Let me know if you discover any other issues!
Best regards,
Even
Hi,
Thanks for this post, I thought Microsoft should have packaged the Tag Cloud web part to populate list Items or Metadata properties… to make life easy for us – SharePoint admins.
I have a few problems while setting up the webpart from the codeplex site, may be you could help me to fix this :
I get this error when configuring the properties of the Taxonomy web part:
Web Part Error: Unhandled exception was thrown by the sandboxed code wrapper’s Execute method in the partial trust app domain: An unexpected error has occurred.
And if I don’t set the properties this is the message I get:
Taxonomy WebPart
Error rendering web part: List ‘/Lists/Keywords’ does not exist at site with URL ‘http://splab/kbase’.
I am very sure, I have the ‘Keywords’ custom list to which it has a managed metadata column, which I want to show as Tag Cloud.
Some internet blogs suggest that the first error is due to a web-part inheritance failure, however I have my doubts as this codeplex web-part is being used by so many people and it works for them.
Any help in the direction of fixing this will be greatly appreciated.
Thanks, Sabs
Hi Sabs,
I’m far from an expert on this field, so I would suggest you post your question at the CodePlex web site. One suggestion though: Have you tried using just ‘/Keywords’ as the list name in the settings instead of ‘/Lists/Keywords’? Just a thought.
Even
Hi there
This tag cloud works fine with a small disadvantage: if there is no keyword which contain a space there is never a line-break and the cloud grow in one single line. Any suggestions for that?
Hi Christian,
I’m not sure if I understand your issue correctly. But you might want to try explicitly setting the width of the cloud web part to less than the page width to force a line break. If that doesn’t do the trick, please elaborate a bit on your issue.
Even
Hey again Christian,
Now I get your problem. The whole thing is solved if you put in a couple of spaces in the delimiter span. I’ll update the code to reflect this. Thanks for your input!
Hi, did you ever resolve the first issue?
Web Part Error: Unhandled exception was thrown by the sandboxed code wrapper’s Execute method in the partial trust app domain: An unexpected error has occurred.
I get this whenever i attempt to add the web part.
Garry
Hey Garry,
I haven’t been able to reproduce your issue so I’m sorry but I can’t really help you out. Best of luck though.
Have you tried to restart the sandbox service in central administration?
Pingback: Mein Linkdump 28. November 2011 | My Workstation