Hi,
Newbie here :)
From this XML file,
http://pages.infinit.net/plague/top500.xml
How do I go about producing an XSLT file that will produce this output:
http://pages.infinit.net/plague/countrystats.png
I'm not asking a complete XSLT, just point me in the right direction, please. I expect use of the Muench algorithm and xsl:key but my attempts have been unsuccessful.
So far I'm a long way to go. Here's my XSLT file in progress. It correctly displays the amount of entries (sites) each country appears in, but doesn't eliminate repeats, and doesn't sort! And I haven't even thought about how I'm gonna implement the share %.
Thanks! :)
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:top500="http://www.top500.org/xml/top500/1.0">
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:key name="sites-by-country" match="top500:site" use="top500:country"/>
<xsl:template match="/top500:list">
<html>
<head>
<title>ALL COUNTRIES IN TOP 500</title>
</head>
<body>
<table style="text-align:left">
<tr style="background-color=7777FF">
<th width="150">Countries</th>
<th>Count</th>
<th>Share %</th>
</tr>
<xsl:for-each select="top500:site/top500:country">
<xsl:sort select="top500:country"/>
<tr>
<td>
<xsl:value-of select="."/>
</td>
<td>
<xsl:value-of select="count(//top500:site[top500:country=current()])"/>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>