Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XSLT : Grouping Child Nodes...

 
Naveen Mishra
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
Thanks a lot.
 
Naveen Mishra
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hooooooo...ff

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




....

Thanks Ketan...
 
Naveen Mishra
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
....
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..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic