XSLT 1.0 textlist to individual elements and duplicate removal

I have the following XML document:\[code\]<?xml version="1.0" encoding="UTF-8"?><cars> <car body="Wagon"> <text>Red</text> </car> <car body="Sedan"> <text>Yellow</text> </car> <car body="Sedan"> <text></text> </car> <car body="Wagon"> <textlist> <text>Red</text> <text>Green</text> <text>Black</text> <text>Blue</text> </textlist> </car> <car body="Sedan"> <textlist> <text>Yellow</text> <text>Orange</text> </textlist> </car> <car body="Fastback"> <textlist> <text>Yellow</text> <text>Red</text> <text>Green</text> <text>Black</text> <text>Blue</text> </textlist> </car> <car body="Fastback"> <textlist> <text>Pink</text> <text>Red</text> <text>Orange</text> </textlist> </car></cars>\[/code\]Using XSLT 1.0 I need to transform the XML document to this format:\[code\]<?xml version="1.0" encoding="UTF-8"?><cars> <car type="Wagon">Red</car> <car type="Sedan">Yellow</car> <car type="Wagon">Green</car> <car type="Wagon">Black</car> <car type="Wagon">Blue</car> <car type="Sedan">Orange</car></cars>\[/code\]Notice that:[*]body="Fastback" is excluded[*]Duplicates are excluded (Red Wagonappears twice)[*]Textlist multiple items are put as individualelements in the output XML[*]Ignore empty values
 
Back
Top