Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

supressing duplicate nodes and counting occurrences

Status
Not open for further replies.

divinyl

IS-IT--Management
Nov 2, 2001
163
GB
Hi all,

Firstly, i'm a complete beginner so please bear with me.

Here is an example of what i need to do. Say this is my XML file:

<person>
<name>John</name>
<person>
<cars>
<car>
<make>BMW</make>
</car>
<car>
<make>Mercedes</make>
</car>
<car>
<make>Ford</make>
</car>
<car>
<make> BMW </make>
</car>
<car>
<make> BMW </make>
</car>
</cars>


In the XSLT file i have to work with, it displays a person and their cars (based on a relationship in the underlying database). If the person has more than one BMW, it displays duplicate records depending on how many BMWs they have. What i want is ONE row for each person and instead of listing the car "make" i want the number of cars with that make, so i assume a calculation using count? So a typical record in my results would be:

Person: John
Number of BMWs: 3
Number of Mercedes: 1
Number of Ford: 1

So the question is, a) how to limit my results to one record
for john and b) displaying a count for each "make" of car.

I hope this is clear - i made up an example because my real data is too complicated.

I hope you can help!

Thanks

Divinyl


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top