Solved

xml - count

Posted on 2007-03-30
3
433 Views
Last Modified: 2008-02-01
Hi,
On the XML below how do I get the count of institutions that their stateProvince is IL .
I think it has to be done with count()
Thanks,
Chicho

         <Institution>
            <Address>
              <addressLine1>400 N LAKEVIEW PKWY</addressLine1>
              <city>VERNON HILLS</city>
              <country>UNITED STATES</country>
              <county>LAKE</county>
              <postalCode>60061</postalCode>
              <stateProvince>IL</stateProvince>
            </Address>
          </Institution>
<Institution>
            <Address>
              <addressLine1>400 N LAKEVIEW PKWY</addressLine1>
              <city>VERNON HILLS</city>
              <country>UNITED STATES</country>
              <county>LAKE</county>
              <postalCode>60061</postalCode>
              <stateProvince>FL</stateProvince>
            </Address>
          </Institution>
<Institution>
            <Address>
              <addressLine1>400 N LAKEVIEW PKWY</addressLine1>
              <city>VERNON HILLS</city>
              <country>UNITED STATES</country>
              <county>LAKE</county>
              <postalCode>60061</postalCode>
              <stateProvince>IL</stateProvince>
            </Address>
          </Institution>
0
Comment
Question by:chicho12
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 500 total points
ID: 18823967
inside an XSLT that would be
<xsl:value-of select="count(//Institution[stateProvince = 'IL'])" />

in a DOM program that would be something like
oNodes = oXML.selectNodes("//Institution[stateProvince = 'IL']");
count = oNodes.length;

cheers

Geert
0
 

Author Comment

by:chicho12
ID: 18824889
it worked.
Thanks,

Chicho
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 18825154
welcome
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question