Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

xml - count

Posted on 2007-03-30
3
Medium Priority
?
441 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 2000 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

Give Your Engineering Team a Productivity Boost

Learn why container technology is so powerful and how it can provide your team with productivity gains and other benefits.

Question has a verified solution.

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

Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

715 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