Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XSL- Is there a way to dynamically add the total number of elements with a common value?

From: "Joe Fawcett" <joefawcett@---------.------>
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






transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent