[xsl] xslt count distinct values - X3D

Subject: [xsl] xslt count distinct values - X3D
From: j milo taylor <milo@xxxxxxxxxx>
Date: Wed, 13 Aug 2008 00:20:24 +0100
I need to count the distinct <Country> values from this XML and this to be assigned to the 'size'; dattribute of a <Box> element in X3D

The XML (fragment example)/////////////////////////////////////////

<Artists_by_Countries>

   <Artist_by_Country>
       <Location_ID>62</Location_ID>
       <Artist_ID>212</Artist_ID>
       <Country>Argentina</Country>
   </Artist_by_Country>

    <Artist_by_Country>
       <Location_ID>4</Location_ID>
       <Artist_ID>108</Artist_ID>
       <Country>Australia</Country>
   </Artist_by_Country>

    <Artist_by_Country>
       <Location_ID>4</Location_ID>
       <Artist_ID>111</Artist_ID>
       <Country>Australia</Country>
   </Artist_by_Country>

   <Artist_by_Country>
       <Location_ID>12</Location_ID>
       <Artist_ID>78</Artist_ID>
       <Country>Germany</Country>
   </Artist_by_Country>

</Artists_by_Countries>

I've been using this XSLT, but getting nowhere (the Muenchian Method??) (using Netbeans)

XSLT///////////////////////////////////////////psuedo

<xsl:key name="artists-by-country" match="Artist_by_Country" use="Country" />
..
..
..
<xsl:template match="Artists_by_Countries">
<xsl:for-each select="Artist_by_Country[count(. | key('artists-by-country', Country)[1]) = 1]">
<Transform>
<Shape>
<Box>
<xsl:attribute name ='size'>
<xsl:value-of=" KEY COUNT OF DISTINCT COUNTRY VALUES>


</xsl:attribute>
</Box>
</Shape>
</Transform> </xsl:for-each>
</xsl:template>


Please, any help/advice anyonr has would be great. Coming to the end of a Phd and my head is exploding!!!

Best regards
Milo

Current Thread