<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">

	<xsl:template match="web-analytics">
		<xsl:variable name="sitevisits"><xsl:value-of select="totalsitevisits"/></xsl:variable>
		<h1><center>Ten Most Active Pages</center></h1>

		<table align="center" border="1" cellspacing="0" cellpadding="0" height="100">
			<xsl:for-each select="page">
				<xsl:sort select="numberofvisits" data-type="number" order="descending"/>
				<xsl:if test="position() &lt;= 10">
					<xsl:variable name="numberofvisits"><xsl:value-of select="numberofvisits"/></xsl:variable>
					<tr>
						<td width="50%">
							<xsl:value-of select="@name"/>
						</td>
						<td>
							<table width="200" height="100%" cellpadding="0" cellspacing="0">
								<tr>
									<td bgcolor="#00AA00" width="{($numberofvisits div $sitevisits) * 100}">
									</td>

									<td width="100">
										<xsl:value-of select="$numberofvisits"/> visits
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</xsl:if>
			</xsl:for-each>
		</table>
	</xsl:template>
</xsl:stylesheet>
