Link to home
Start Free TrialLog in
Avatar of CCHSA
CCHSA

asked on

group and count xml nodes using XSL

Hi,

I have  a requirement to count the xml nodes after grouping.

 <tblIndividualCriteriaRating RatingValue="4" CriteriaCode="cIM00033" Version="4" TeamID="7457" SurveyorID="710" />
  <tblIndividualCriteriaRating RatingValue="4" CriteriaCode="cIM00034" Version="4" TeamID="7457" SurveyorID="710" />
  <tblIndividualCriteriaRating RatingValue="4" CriteriaCode="cIM00035" Version="4" TeamID="7457" SurveyorID="710" />
  <tblIndividualCriteriaRating RatingValue="4" CriteriaCode="cAC00001" Version="4" TeamID="7460" SurveyorID="710" />
  <tblIndividualCriteriaRating RatingValue="4" CriteriaCode="cAC00002" Version="4" TeamID="7460" SurveyorID="710" />
  <tblIndividualCriteriaRating RatingValue="4" CriteriaCode="cAC00003" Version="4" TeamID="7460" SurveyorID="710" />
  <tblIndividualCriteriaRating RatingValue="4" CriteriaCode="cAC00006" Version="4" TeamID="7460" SurveyorID="710" />
  <tblIndividualCriteriaRating RatingValue="4" CriteriaCode="cAC00007" Version="4" TeamID="7460" SurveyorID="710" />
  <tblIndividualCriteriaRating RatingValue="4" CriteriaCode="cAC00008" Version="4" TeamID="7460" SurveyorID="710" />
  <tblIndividualCriteriaRating RatingValue="4" CriteriaCode="cAC00009" Version="4" TeamID="7460" SurveyorID="710" />


In the above sample the teamid for some nodes are 7457 and some are 7460.

All I need to do is to count the number of nodes that have teamid 7457 and for 7460.

My expected result should be

7457 - 4
7460 - 7

Any ideas using XSL or VB.Net is much appreciated.

ASKER CERTIFIED SOLUTION
Avatar of BobSiemens
BobSiemens

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CCHSA
CCHSA

ASKER

Hi Bob,

Thanks for the reply. I forgot to mention that the data is dynamic. Only the schema is permanant.

I found the solution. I used preceding-sibling to find the break between the teamids and then took store the teamid in variable. and count the nodes where the teamid matches the variable.

Thanks
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial