Link to home
Create AccountLog in
Avatar of gillsboy123
gillsboy123

asked on

XSLT COUNT FUNCTION

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

ASKER CERTIFIED SOLUTION
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of gillsboy123
gillsboy123

ASKER

Thank you. It worked really weel
Cheers.