473,508 Members | 4,779 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sorting and grouping with XSL Stylesheets

Hi,
I am using MSXML 3.0rc.

I have a document similar to the following:

<?xml version="1.0"?>
<cars>
<car name="Mercedes">
<model built="1985" style="Sedan">560 SEL</model>
<model built="1979" style="Coupe">520 SLC</model>
</car>
<car name="Dodge">
<model built="2004" style="Wagon">Magnum</model>
<model built="2004" style="Sedan">300</model>
</car>
<car name="Chevrolet">
<model built="2005" style="Sedan">Malibu</model>
<model built="2004" style="Sedan">Malibu</model>
<model built="2003" style="Sedan">Malibu</model>
</car>
<car name="BMW">
<model built="2005" style="Hatchback">Mini</model>
<model built="2005" style="Coupe">315i</model>
<model built="2005" style="Coupe">Z4</model>
</car>
<car name="Cadillac">
<model built="2004" style="SUV">Escalade</model>
<model built="2004" style="Sedan">STS</model>
<model built="2004" style="Sedan">CTS</model>
<model built="1981" style="Coupe">Coupe DeVille</model>
</car>
</cars>

And I would like to produce the following: note that /model of the
same /car@name with the same ( /model/@built and /model/@style ) are
contained in the same <div> and the div are in order of /car/@name,
this needs to be created in an xsl stylesheet, the sorting I can do
but haven't figured out how to group the similar items together.

Any assistance would be most appreciated

Thanks Jack

<div>
<table>
<tr>
<td>BMW - 2005 - Coupe </td>
</tr>
<tr>
<td>315i, Z4</td>
</tr>
</table>
</div>
<div>
<table>
<tr>
<td>BMW - 2005 - Hatchback</td>
</tr>
<tr>
<td>Mini</td>
</tr>
</table>
</div>
<div>
<table>
<tr>
<td>Cadillac - 2004 - SUV</td>
</tr>
<tr>
<td>Escalade</td>
</tr>
</table>
</div>
<div>
<table>
<tr>
<td>Cadillac - 2004 - Sedan</td>
</tr>
<tr>
<td>CTS, STS</td>
</tr>
</table>
</div>
<div>
<table>
<tr>
<td>Cadillac - 1981 - Coupe</td>
</tr>
<tr>
<td>Copupe DeVille</td>
</tr>
</table>
</div>
<div>
<table>
<tr>
<td>Chevrolet - 2004 - Sedan</td>
</tr>
<tr>
<td>Malibu</td>
</tr>
</table>
</div>
<div>
<table>
<tr>
<td>Chevrolet - 2003 - Sedan</td>
</tr>
<tr>
<td>Malibu</td>
</tr>
</table>
</div>
<div>
<table>
<tr>
<td>Chevrolet - 2002 - Sedan</td>
</tr>
<tr>
<td>Malibu</td>
</tr>
</table>
</div>
<div>
<table>
<tr>
<td>Dodge - 2004 - Wagon</td>
</tr>
<tr>
<td>Magnum</td>
</tr>
</table>
</div>
<div>
<table>
<tr>
<td>Dodge - 2004 - Sedan</td>
</tr>
<tr>
<td>300</td>
</tr>
</table>
</div>
<div>
<table>
<tr>
<td>Mercedes - 1985 - Sedan</td>
</tr>
<tr>
<td>560 SEL</td>
</tr>
</table>
</div>
<div>
<table>
<tr>
<td>Mercedes - 1979 - Coupe</td>
</tr>
<tr>
<td>520 SLC</td>
</tr>
</table>
</div>
Jul 20 '05 #1
0 1150

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
3487
by: Mike MacSween | last post by:
tblCourses one to many to tblEvents. A course may have an intro workshop (a type of event), a mid course workshop, a final exam. Or any combination. Or something different in the future. At...
5
1907
by: Mike | last post by:
Hello All, I have a report based upon a query. I have added a control to report footer that calcs the total cost of the inventory: =SUM(). When this total calculation is NOT on the report,...
6
2489
by: Michiel Kamermans | last post by:
Hi, I need to generate a list based on a sorted nodeset, except duplicates need to be discarded. I initially though of doing a sort on a nodeset and then passing it to a template that iterates...
4
2991
by: kstevens | last post by:
I have a report, and on the report is a min, avg, and max query each with (ok who really cares) 20 or so records. At the footer of the report i would like to have a total. I requery for each...
0
7128
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7058
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5057
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4715
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3206
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3191
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1565
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.