[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

xslt count distinct values - X3D

Subject: xslt count distinct values - X3D
From: j milo taylor <milo@xxxxxxxxxx>
Date: Wed, 13 Aug 2008 00:20:24 +0100
 xslt count distinct values - X3D
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.