<xsl:stylesheet version="1.0"
	xmlns:date="http://exslt.org/dates-and-times"
	xmlns:maths="http://exslt.org/math" xmlns:ebe="http://cks/ebemethods"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="date ebe maths">

	<xsl:param name="IsBlogOwner" />
	<xsl:param name="RelativeUrl" />
	<xsl:output omit-xml-declaration="yes" />

	<xsl:template match="/">
		<xsl:variable name="min">
			<xsl:value-of select="maths:min(rows/row/@PostCount)"/>
		</xsl:variable>
		<xsl:variable name="max">
			<xsl:value-of select="maths:max(rows/row/@PostCount)"/>
		</xsl:variable>
		<xsl:apply-templates select="rows/row">
			<xsl:with-param name="max" select="$max"/>
			<xsl:with-param name="min" select="$min"/>
			<xsl:sort select="Title"/>
		</xsl:apply-templates>
	</xsl:template>

	<xsl:template match="row">
		<xsl:param name="max"/>
		<xsl:param name="min"/>
		<xsl:variable name="weightPercent" select="(@PostCount div $max) * 100"/>
		<xsl:variable name="weight">
			<xsl:choose>
				<xsl:when test="$weightPercent &gt; 93">
					1
				</xsl:when>
				<xsl:when test="$weightPercent &gt; 80">
					2
				</xsl:when>
				<xsl:when test="$weightPercent &gt; 60">
					3
				</xsl:when>
				<xsl:when test="$weightPercent &gt; 40">
					4
				</xsl:when>
				<xsl:when test="$weightPercent &gt; 20">
					5
				</xsl:when>
				<xsl:when test="$weightPercent &gt; 10">
					6
				</xsl:when>
				<xsl:when test="$weightPercent &gt; 5">
					7
				</xsl:when>
				<xsl:otherwise>
					8
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>

		<a class="w{number($weight)}" href="{ebe:createTagUrl(Title)}">
			<xsl:value-of select="Title"/>
			<!--<xsl:if test="position()!=last()"></xsl:if>-->
		</a>
		<br/>

	</xsl:template>

</xsl:stylesheet>
