xsl-list
[Top] [All Lists]

[xsl] xslt count distinct values - X3D

2008-08-12 16:20:54
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




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>