Solved

xml - count

Posted on 2007-03-30
3
423 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
  • 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
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.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

758 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now