Solved

xml - count

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
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.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

805 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