Grouping and Unique Records

G

Gadrin77

I'm looking to create a list/report using the following XML...

<Root>
<Contact Name="Joe" Level="9" Class="Customer"/>
<Contact Name="Jim" Level="7" Class="Customer"/>
<Contact Name="Bob" Level="2" Class="Employee"/>
<Contact Name="Fred" Level="8" Class="Customer"/>
<Contact Name="Tom" Level="3" Class="Customer"/>
<Contact Name="Marty" Level="3" Class="Customer"/>
<Contact Name="Mike" Level="6" Class="Customer"/>
<Contact Name="Suzi" Level="10" Class="Customer"/>
<Contact Name="Sarah" Level="1" Class="Vendor"/>
<Contact Name="Dylan" Level="5" Class="Employee"/>
</Root>

The idea is to Group by Class, then Group each Contact by Level within that
class, then break, move to the Next Class and do the same...

Customer

Level 3: Marty, Tom.
Level 6: Mike.
Level 7: Jim.
Level 8: Fred.
Level 9: Joe.
Level 10: Suzi.

Employee

Level 2: Bob.
Level 5: Dylan.

Vendor

Level 1: Sarah.

It looks like I need to generate unique ids or use a key for each CLASS,
then build another key based on levels. But I'm not able to visualize how
to do it in XSL. Recursive template???

I'm using MS XML SDK 4.0 SP2.
 
Z

Zdenek Oklestek

Gadrin77 napsal(a):
I'm looking to create a list/report using the following XML...

<Root>
<Contact Name="Joe" Level="9" Class="Customer"/>
<Contact Name="Jim" Level="7" Class="Customer"/>
<Contact Name="Bob" Level="2" Class="Employee"/>
<Contact Name="Fred" Level="8" Class="Customer"/>
<Contact Name="Tom" Level="3" Class="Customer"/>
<Contact Name="Marty" Level="3" Class="Customer"/>
<Contact Name="Mike" Level="6" Class="Customer"/>
<Contact Name="Suzi" Level="10" Class="Customer"/>
<Contact Name="Sarah" Level="1" Class="Vendor"/>
<Contact Name="Dylan" Level="5" Class="Employee"/>
</Root>

The idea is to Group by Class, then Group each Contact by Level within that
class, then break, move to the Next Class and do the same...

Customer

Level 3: Marty, Tom.
Level 6: Mike.
Level 7: Jim.
Level 8: Fred.
Level 9: Joe.
Level 10: Suzi.

Employee

Level 2: Bob.
Level 5: Dylan.

Vendor

Level 1: Sarah.

It looks like I need to generate unique ids or use a key for each CLASS,
then build another key based on levels. But I'm not able to visualize how
to do it in XSL. Recursive template???

I'm using MS XML SDK 4.0 SP2.

You look http://www.kosek.cz/xml/xslt/seskupovani.html .
This is in czech language, but exaple is understandable.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top