Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - XSL- Is there a way to dynamically add the total number of elements with a common value? >Thread Next - Re: XSL- Is there a way to dynamically add the total number of elements with a common value? Re: XSL- Is there a way to dynamically add the total number of elements with a common value?To: NULL Date: 10/21/2008 8:54:00 AM <enajenkins@g...> wrote in message news:2e1a43de-49ad-4aab-ac4c-57dba17fd04d@n...... >I have an .xml doc with over 35,000 entries that I converted from an > Excel file. Each entry (element/person) has the typical firstname, > lastname, email, city, state child elements. I need to dynamically > tabulate the total number of people who live in each state. Is there a > way to do this with XSL, or Javascript? > > This is for a Google Maps project. I'd like to be able to display the > number of Alumni living in each state in the mouseover window. > > > Sample XML: > > <USalumni> > <alum> > <alumniID>1</alumniID> > <firstname>John</firstname> > <lastname>Doe</lastname> > <email>jondoe@e...</email> > <state>IL</state> > <country>US</country> > </alum> > <alum> > <alumniID>2</alumniID> > <firstname>Sam</firstname> > <lastname>Sonite</lastname> > <email>samsonite@e...</email> > <state>IL</state> > <country>US</country> > </alum> > <alum> > <alumniID>3</alumniID> > <firstname>David</firstname> > <lastname>Davidson</lastname> > <email>Dave@e...</email> > <state>MI</state> > <country>US</country> > </alum> > <alum> > <alumniID>4</alumniID> > <firstname>Snow</firstname> > <lastname>White</lastname> > <email>snow@e...</email> > <state>LA</state> > <country>US</country> > </alum> > <alum> > <alumniID>5</alumniID> > <firstname>Mary</firstname> > <lastname>Lamb</lastname> > <email>lamb@e...</email> > <state>IL</state> > <country>US</country> > </alum> > <alum> > <alumniID>6</alumniID> > <firstname>Jane</firstname> > <lastname>Smith</lastname> > <email>jsmith@e...</email> > <state>MO</state> > <country>US</country> > </alum> > </USalumni> I would take a look online at Muenchian grouping. That will enable you to get a distinct list of all States. Once you have that you can then use xsl:for-each and show count(alum[state = .]) where . represents the current state being processed. http://www.jenitennison.com/xslt/grouping/muenchian.html -- Joe Fawcett (MVP - XML) http://joe.fawcett.name | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
