Help - use XSLT to group by multiple values?

N

n.phelge

I'm using XSLT and .NET Framework 1.1 to try to transform XML to group
by multiple values, and I'm not succeeding. I have source XML that
looks like the following:

<Data>
<Flavor>
<Name>Vanilla</Name>
<StartDate>20070704</StartDate>
<EndDate>20071231</EndDate>
</Flavor>
<Flavor>
<Name>Chocolate</Name>
<StartDate>20070704</StartDate>
<EndDate>20071131</EndDate>
</Flavor>
<Flavor>
<Name>Strawberry</Name>
<StartDate>20070804</StartDate>
<EndDate>20071131</EndDate>
</Flavor>
<Flavor>
<Name>Mint</Name>
<StartDate>20070704</StartDate>
<EndDate>20071131</EndDate>
</Flavor>
</Data>


I need to group the items together that have the same values for
StartDate and EndDate such that the output looks like the following:

<Groups>
<Group>
<Name>Group1</Name>
<Flavors>
<Name>Vanilla</Name>
</Flavors>
<StartDate>20070704</StartDate>
<EndDate>20071231</EndDate>
</Group>
<Group>
<Name>Group2</Name>
<Flavors>
<Name>Chocolate</Name>
<Name>Mint</Name>
</Flavors>
<StartDate>20070704</StartDate>
<EndDate>20071131</EndDate>
</Group>
<Group>
<Name>Group3</Name>
<Flavors>
<Name>Strawberry</Name>
</Flavors>
<StartDate>20070804</StartDate>
<EndDate>20071231</EndDate>
</Group2>
</Groups>

I've tried to use the Muenchian Method with keys, but I haven't been
successful. Can anyone please provide some assistance?

Thanks in advance
 
P

Pavel Lepin

n.phelge said:
I need to group the items together that have the same
values for StartDate and EndDate such that the output
looks like the following:
[...]

I've tried to use the Muenchian Method with keys, but I
haven't been successful. Can anyone please provide some
assistance?

You know of the Muenchian grouping, but you 'haven't been
successful', you didn't post any code, and you
want 'assistance'? Do you want someone to write the code
for you? This an entry-level grouping problem, do your own
homework.
 

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

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top