Solved

xml - count

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

Understanding Linux Permissions

Linux for beginners: How to view the permissions associated with files and directories and also how you can change them.

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…
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

636 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