Hi everyone!

I'm quite new to XML and XSLT and am trying to work out how to do the following example:

xml code:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="Example02.xsl" type="text/xsl"?>

		<name>Lhasa Apso</name>

XSLT code:

<?xml version="1.0" encoding="UTF-8"?>

<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
<xsl:key name="dogs" match="/root/dog" use="breed"/>

	<xsl:template match="/">
			 <head> <title>Example02</title></head>
				 <table border="1">
					 <tr bgcolor="#9acd32">
						 <th>Number of Dogs</th>
					 <xsl:for-each select="root/dog[generate-id() = generate-id(key('dogs',breed)[1])]">
						 <xsl:sort select="breed"/>
							 <th><xsl:value-of select="breed"/></th>

I have written it so that if you open the xml file in explorer you get a table which shoes the different breeds of dogs in the left hand column.

The part that I am unable to do it to fill the right hand column with the number of each breed of dog that is in the xml...

I believe I should use count() somehow but am having trouble working out exactly what to do...

any help would be appreciated.


(files should be attached too)