homepage Welcome to WebmasterWorld Guest from 50.19.169.37
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / XML Development
Forum Library, Charter, Moderators: httpwebwitch

XML Development Forum

    
Sorting XML document to create another one?
TooMuch2AM




msg:3832345
 4:36 pm on Jan 22, 2009 (gmt 0)

In need of some good advice on 'consolidating' an XML file into another using XSL folks. Hope you can help!

My souce XML looks like so:

<?xml version="1.0" encoding="utf-8"?>
<vehicles>
<make xmake="ALFA ROMEO">
<model xmodel="159 SPORTWAGON">
<derivative xderivative="3.2 V6 JTS Q4 Lusso 5dr" />
</model>
</make>
<make xmake="ALFA ROMEO">
<model xmodel="SPIDER CONVERTIBLE">
<derivative xderivative="3.2 V6 JTS Q4 2dr" />
</model>
</make>
<make xmake="ALFA ROMEO">
<model xmodel="SPIDER CONVERTIBLE">
<derivative xderivative="2.8 V6 Q4 2dr" />
</model>
</make>
<make xmake="CITROEN">
<model xmodel="C4 COUPE SPECIAL EDITIONS">
<derivative xderivative="1.6HDi 16V by LOEB 3dr" />
</model>
</make>
<make xmake="FORD">
<model xmodel="S-MAX DIESEL ESTATE">
<derivative xderivative="2.0 TDCi LX 5dr" />
</model>
</make>
</vehicles>

Basically I have several vehicles but need to group them by Make, Model and Derivative thus:

<vehicles>
<make name='ALFA ROMEO'>
<model name='159 SPORTWAGON'>
<Derivative>3.2 V6 JTS Q4 Lusso 5dr</Derivative>
</model>
<model name='SPIDER CONVERTIBLE'>
<Derivative>3.2 V6 JTS Q4 2dr</Derivative>
<Derivative>2.8 V6 Q4 2dr</Derivative>
</model>
</make>
<make name='CITROEN'>
<model name='C4 COUPE SPECIAL EDITIONS'>
<Derivative>1.6HDi 16V by LOEB 3dr</Derivative>
</model>
</make>
<make name='FORD'>
<model name='S-MAX DIESEL ESTATE'>
<Derivative>2.0 TDCi LX 5dr</Derivative>
</model>
</make>
</vehicles>

I'm pretty new to using XSL so any pointers towards how to acheive this would be gratefully received!

Many thanks!
TM2AM

[edited by: TooMuch2AM at 4:38 pm (utc) on Jan. 22, 2009]

 

ronburk




msg:3832680
 12:10 am on Jan 23, 2009 (gmt 0)

Tedious (as most XSLT programming is), but possible. Google for "grouping using the muenchian method" and see whether that clicks for you.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / XML Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved