?
Solved

XSLT COUNT FUNCTION

Posted on 2010-11-16
4
Medium Priority
?
423 Views
Last Modified: 2012-05-10
I can successfully count all incomingAnswered calls from it's immediate ancestor, in this case extension id="10002".

What I want to do is count from a higher level, in this case <site id="2" name="Tech Support">.

So basically irrespective of how high in the hierarchy I am I want to be able to count all incomingAnswered calls for all children.

Can anyone please advise.

Thank you.
HERE IS XML CODE EXAMPLE:

<?xml version="1.0" encoding="utf-8"?>
<overviewData>
  <items id="0">
    <region id="1" name="New Items">
      <site id="2" name="Tech Support">
        <extension id="10002" name="2361" extensionNumber="2361">
          <incomingAnswered id="1">
            <cdrRecord startDate="23/12/2004" startTime="11:12:00" cli="01229763522" destination="2361" sourceLocation="Millom" duration="03:06:20" cost="0" />
            <cdrRecord startDate="23/12/2004" startTime="11:12:00" cli="09830371093" destination="2361" sourceLocation="Premium Rate" duration="03:06:20" cost="0" />
            <cdrRecord startDate="23/12/2004" startTime="11:12:00" cli="01233763522" destination="2361" sourceLocation="Ashford" duration="03:06:20" cost="0" />
            <cdrRecord startDate="23/12/2004" startTime="11:12:00" cli="118600" destination="2361" sourceLocation="UNAVAILABLE" duration="03:06:20" cost="0" />
            <cdrRecord startDate="23/12/2004" startTime="11:12:00" cli="01612272811" destination="2361" sourceLocation="Manchester" duration="03:06:20" cost="0" />
          </incomingAnswered>
          <outgoingAnswered id="2">
            <cdrRecord startDate="23/12/2004" startTime="15:12:00" destination="O2" dialledNumber="07594702887" duration="00:06:20" cost="0.82" />
          </outgoingAnswered>
        </extension>
      </site>
   </region>
  </items>
</overviewData>

HERE IS XSL COUNT FUNCTION:

<xsl:value-of select="count(incomingAnswered/cdrRecord)"></xsl:value-of>

Open in new window

0
Comment
Question by:gillsboy123
  • 2
  • 2
4 Comments
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 2000 total points
ID: 34144237
count(.//incomingAnswered) will do that
0
 

Author Comment

by:gillsboy123
ID: 34144319
Thank you. It worked really weel
0
 

Author Closing Comment

by:gillsboy123
ID: 34144324
Cheers.
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 34148624
welcome
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

850 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