Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 17th, 2009, 04:26 AM
Authorized User
 
Join Date: Nov 2009
Posts: 10
Thanks: 1
Thanked 1 Time in 1 Post
Default Grouping the nested list accroding to the level

My input file
------------------
<body>
<some_element></some_element>
<some_element></some_element>
<l1></l1>
<l1></l1>
<l1></l1>
<l2></l2>
<l2></l2>
<l2></l2>
<some_element></some_element>
<some_element></some_element>
<l1></l1>
<l1></l1>
<l1></l1>
<l2></l2>
<l2></l2>
<l2></l2>
<l1></l1>
<some_element></some_element>
<some_element></some_element>
<l1></l1>
<l1></l1>
<l1></l1>
<l2></l2>
<l2></l2>
<l2></l2>
<l3></l3>
<l3></l3>
<l2></l2>
<l1></l1>
<l1></l1>
</body>

Note: some_elemnt means not a particular element


I need the following output
-----------------------------------------
<body>
<some_element></some_element>
<some_element></some_element>
<list1>
<l1></l1>
<l1></l1>
<l1>
<lilst2>
<l2></l2>
<l2></l2>
<l2></l2>
</list2>
</l1>
</list1>
<some_element></some_element>
<some_element></some_element>
<list1>
<l1></l1>
<l1></l1>
<l1>
<lilst2>
<l2></l2>
<l2></l2>
<l2></l2>
</list2>
</l1>
<l1></l1>
</list1>

<some_element></some_element>
<some_element></some_element>
<list1>
<l1></l1>
<l1></l1>
<l1>
<list2>
<l2></l2>
<l2></l2>
<l2>
<list3>
<l3></l3>
<l3></l3>
</list3>
</l2>
<l2></l2>
</list2>
</l1>
<l1></l1>
<l1></l1>

</body>

Dear all,

As i mentioned above, want to get the output using XSLT.
I've tried a lot with for-each-group but not succeeded.

pls tell me your suggetions and comments.


Regards
Bala
The Following User Says Thank You to priyan24 For This Useful Post:
 
Old November 17th, 2009, 06:20 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

There's a very similar problem tackled in this paper which you could adapt.

http://www.saxonica.com/papers/ideadb-1.1/mhk-paper.xml
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
 
Old November 17th, 2009, 07:17 AM
Authorized User
 
Join Date: Nov 2009
Posts: 10
Thanks: 1
Thanked 1 Time in 1 Post
Default

Thank you very much.





Similar Threads
Thread Thread Starter Forum Replies Last Post
NESTED GROUPING USING XSLT1.0 jhansib4u Classic ASP XML 0 November 19th, 2007 09:12 AM
Grouping in XSLT at same level of hierarchy... concen XSLT 2 April 6th, 2006 10:12 AM
Grouping List chemi XSLT 1 October 20th, 2005 09:36 AM
XSLT - 2 level grouping & sequencing krayan001 XSLT 3 June 27th, 2005 01:23 PM
Non-recursive Data multi-level grouping jmurdock BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 0 June 30th, 2004 03:42 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.