XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Paul ElliottSubject: difficult problem for an xslt newbie
Author: Paul Elliott
Date: 15 Sep 2006 04:58 PM
I am trying to write an xslt that will take a structure similar to this:

<root>
<element-a />
<element-b />
<element-a />
<element-a />
<element-b />
<element-c />
<element-b />
</root>

There can be any number of element-a's, each followed by any number of element-b's, each followed by any number of element-c's. The c's always follow the b's and the b's always follow the a's.
The format I am trying to transform it into something looks like this:
<root>
<element-a>
<element-b />
</element-a>
<element-a />
<element-a>
<element-b>
<element-c />
</element-b>
<element-b />
<element-a />
</root>

In the new format, the c's are children of the b's and the b's are children of the a's. It is in the same order, just now the parent-child relationships are enforced.
What is the easiest way to accomplish this. I am having trouble tackling this functionally. Any help would be greatly appreciated. Thanks in advance!

Posttop
Tony LavinioSubject: difficult problem for an xslt newbie
Author: Tony Lavinio
Date: 21 Sep 2006 10:34 AM
This is the classic XSLT grouping problem.
Type "XSLT grouping" into Google, or go
direct to a very clear explanation (with examples!)
at http://www.jenitennison.com/xslt/grouping/

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.