Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

collapse tree view using xsl

 
kesava chaitanya
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my xml file is like this

<WORLD>
<COUNTRY COUNTRYID="INDIA">
<STATE STATEID="ANDHRAPRADESH">
<CITY>HYDERABAD</CITY>
<CITY>VIZAG</CITY>
<CITY>KURNOOL</CITY>
</STATE>
<STATE STATEID="TAMILNADU">
<CITY>CHENNAI</CITY>
<CITY>COIMBATORE</CITY>
<CITY>SALEM</CITY>
</STATE>
<STATE STATEID="KARNATAKA">
<CITY>BANGALORE</CITY>
<CITY>MYSORE</CITY>
<CITY>BALLARI</CITY>
</STATE>
</COUNTRY>
<COUNTRY COUNTRYID="AUSTRALIA">
<STATE STATEID="NEW SOUTH WALES">
<CITY>PERTH</CITY>
<CITY>BRIABANE</CITY>
<CITY>HOBART</CITY>
</STATE>
</COUNTRY>
</WORLD>

i want to display expandable/collapse tree structure using xsl;like

world
india
andhrapradesh
hyderabad
vizag
karnataka
bangalore
australia

does anybody provide some code or links to achieve this ;

bye
chaitanya
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bypassing "whatever" you mean by expandable, this should be a very simple transformation. I recommend that you check out zvon.org's website for a tutorial and reference on XSLT. If you were looking for code from somebody on here, I'd give up on that -- it'll be a long wait.
 
kesava chaitanya
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

i know little bit xsl;but i want to display hierarchical tree using xsl;
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I would recommend learning a little bit more xslt, and then using it.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would also help if you could define "expandable" for us?
 
kesava chaitanya
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
expandable means i hierarchical tree view with + ,- signs;
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And you want it to show up on a web page, right? Then the first thing you should do is to write the necessary HTML+JavaScript for doing this. Then, you can develop an XSL stylesheet which transforms your XML into the HTML+JavaScript doing the expand/collapse thing.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic