Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
 

Go Back   XSL - XML - RSS Forums > XSLForum: Main > XSL Coding General

Tags:



Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-20-2008, 11:40 PM
enajenkins@gmail.com
 
Posts: n/a

Default XSL- Is there a way to dynamically add the total number of elementswith a common value?



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@email.com</email>
<state>IL</state>
<country>US</country>
</alum>
<alum>
<alumniID>2</alumniID>
<firstname>Sam</firstname>
<lastname>Sonite</lastname>
<email>samsonite@email.com</email>
<state>IL</state>
<country>US</country>
</alum>
<alum>
<alumniID>3</alumniID>
<firstname>David</firstname>
<lastname>Davidson</lastname>
<email>Dave@email.com</email>
<state>MI</state>
<country>US</country>
</alum>
<alum>
<alumniID>4</alumniID>
<firstname>Snow</firstname>
<lastname>White</lastname>
<email>snow@email.com</email>
<state>LA</state>
<country>US</country>
</alum>
<alum>
<alumniID>5</alumniID>
<firstname>Mary</firstname>
<lastname>Lamb</lastname>
<email>lamb@email.com</email>
<state>IL</state>
<country>US</country>
</alum>
<alum>
<alumniID>6</alumniID>
<firstname>Jane</firstname>
<lastname>Smith</lastname>
<email>jsmith@email.com</email>
<state>MO</state>
<country>US</country>
</alum>
</USalumni>
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 10-21-2008, 09:27 AM
Joe Fawcett
 
Posts: n/a

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

<enajenkins@gmail.com> wrote in message
news:2e1a43de-49ad-4aab-ac4c-57dba17fd04d@n1g2000prb.googlegroups.com...
>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@email.com</email>
> <state>IL</state>
> <country>US</country>
> </alum>
> <alum>
> <alumniID>2</alumniID>
> <firstname>Sam</firstname>
> <lastname>Sonite</lastname>
> <email>samsonite@email.com</email>
> <state>IL</state>
> <country>US</country>
> </alum>
> <alum>
> <alumniID>3</alumniID>
> <firstname>David</firstname>
> <lastname>Davidson</lastname>
> <email>Dave@email.com</email>
> <state>MI</state>
> <country>US</country>
> </alum>
> <alum>
> <alumniID>4</alumniID>
> <firstname>Snow</firstname>
> <lastname>White</lastname>
> <email>snow@email.com</email>
> <state>LA</state>
> <country>US</country>
> </alum>
> <alum>
> <alumniID>5</alumniID>
> <firstname>Mary</firstname>
> <lastname>Lamb</lastname>
> <email>lamb@email.com</email>
> <state>IL</state>
> <country>US</country>
> </alum>
> <alum>
> <alumniID>6</alumniID>
> <firstname>Jane</firstname>
> <lastname>Smith</lastname>
> <email>jsmith@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 = .]) where . represents the current
state being processed.

http://www.jenitennison.com/xslt/gro...muenchian.html

--

Joe Fawcett (MVP - XML)

http://joe.fawcett.name




Reply With Quote
  #3 (permalink)  
Old 10-21-2008, 10:46 PM
enajenkins@gmail.com
 
Posts: n/a

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

On Oct 21, 2:54*am, "Joe Fawcett" <joefawc...@newsgroup.nospam> wrote:
> <enajenk...@gmail.com> wrote in message
>
> news:2e1a43de-49ad-4aab-ac4c-57dba17fd04d@n1g2000prb.googlegroups.com...
>
>
>
> >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 = .]) where . represents the current
> state being processed.
>
> http://www.jenitennison.com/xslt/gro...muenchian.html
>
> --
>
> Joe Fawcett (MVP - XML)
>
> http://joe.fawcett.name- Hide quoted text -
>
> - Show quoted text -




Thank you - I'll try this method...
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



Contact Us -|- XSL - XML - RSS Forums -|- Archive -|- Top -|-Rules/Disclaimer-|-Help/Support -|-Advertise
© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
All times are GMT. The time now is 05:57 PM.
Style Developed by Epic Designz