This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes XSLT : Grouping Child Nodes... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XSLT : Grouping Child Nodes... " Watch "XSLT : Grouping Child Nodes... " New topic
Author

XSLT : Grouping Child Nodes...

Naveen Mishra
Ranch Hand

Joined: Nov 20, 2005
Posts: 75
HI.
I've not done much about xslt but just some helloWorld kind of basics.

I'm trying to render my menu using an xml file generated thru database.
Upto xml I could do fine and got the results buched properly , but not able to produce menus and submenus properly.

I tried out group (xslt2.0) also, but having very little exp/knoledge about xslt could get it done ...

Here is my xml file ...




need the trick to get submenus depends on parent_menu in a grroup . and there may be nesting of submenus also.

Kindly help me .

Thanks a lot.
Ketan Khairnar
Ranch Hand

Joined: Jun 28, 2005
Posts: 34
Hi,
I have utilised my free time and here is rough solution..you might have top chnage that but basic xpath expression will remain same



also it will need additional copy.xslt which has code as follows

Naveen Mishra
Ranch Hand

Joined: Nov 20, 2005
Posts: 75
Hi.
Thanks a lot.
Naveen Mishra
Ranch Hand

Joined: Nov 20, 2005
Posts: 75
Hi Ketan.
Thanks for giving your all imp time for my need.
LAst night I could not test with the solution u provided, today the first I did was that only.

It is ,no doubt , able to get parent menus out , but not able to provide grouping og sub-menus under it... all it shows is children-list of first parent for all..

and , in case of nesting of menu like " ALERTS=>SEND=>EDU_SEND" , it is not doing any such thing .

Thanks any way for your hints . With some basic stuff around , I too can do some work.

Thanks again.

Ketan Khairnar
Ranch Hand

Joined: Jun 28, 2005
Posts: 34
I had hardcoded the value in second for-each loop..
just play around that..
I have already taken PT as varible..replace hardcoded value with that $PT and make it suitable fro your need
Naveen Mishra
Ranch Hand

Joined: Nov 20, 2005
Posts: 75
hi .

Thanks again Ketan.
I was in the same line ...

what I sent was just first look at result and nothing else. ....
thanks again.
Naveen Mishra
Ranch Hand

Joined: Nov 20, 2005
Posts: 75
Hooooooo...ff

Here is the final solution of all the hints and discussion with Ketan...




....

Thanks Ketan...
Naveen Mishra
Ranch Hand

Joined: Nov 20, 2005
Posts: 75
....
Had to change the xml file to get the work done .... ( I know , it could be done , but lack of time made me change the xml structure...) . The solution is based on this xml file ...





thanks..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XSLT : Grouping Child Nodes...