Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: 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?To: NULL Date: 10/21/2008 2:22:00 PM On Oct 21, 2:54=A0am, "Joe Fawcett" <joefawc...@newsgroup.nospam> wrote: > <enajenk...@gmail.com> 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>jon...@email.com</email> > > <state>IL</state> > > <country>US</country> > > </alum> > > <alum> > > <alumniID>2</alumniID> > > <firstname>Sam</firstname> > > <lastname>Sonite</lastname> > > <email>samson...@email.com</email> > > <state>IL</state> > > <country>US</country> > > </alum> > > <alum> > > <alumniID>3</alumniID> > > <firstname>David</firstname> > > <lastname>Davidson</lastname> > > <email>D...@email.com</email> > > <state>MI</state> > > <country>US</country> > > </alum> > > <alum> > > <alumniID>4</alumniID> > > <firstname>Snow</firstname> > > <lastname>White</lastname> > > <email>s...@email.com</email> > > <state>LA</state> > > <country>US</country> > > </alum> > > <alum> > > <alumniID>5</alumniID> > > <firstname>Mary</firstname> > > <lastname>Lamb</lastname> > > <email>l...@email.com</email> > > <state>IL</state> > > <country>US</country> > > </alum> > > <alum> > > <alumniID>6</alumniID> > > <firstname>Jane</firstname> > > <lastname>Smith</lastname> > > <email>jsm...@email.com</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 =3D .]) where . represents the cur= rent > state being processed. > > http://www.jenitennison.com/xslt/grouping/muenchian.html > > -- > > Joe Fawcett (MVP - XML) > > http://joe.fawcett.name- Hide quoted text - > > - Show quoted text - Thank you - I'll try this method... | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
