Skip to content

Instantly share code, notes, and snippets.

@evenv
Created July 1, 2012 12:43
Show Gist options
  • Save evenv/3028333 to your computer and use it in GitHub Desktop.
Save evenv/3028333 to your computer and use it in GitHub Desktop.
transform sharepoint managed metadata into word cloud
<?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&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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment