• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

Have a tree displayed using javascript, xml, xslt - need help with action events for the nodes

Village Idiot
Posts: 484
jQuery Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well I was able to get a tree to display taking the example from this site:


and dropping in elements from my project - I believe the author of that article intended for it to be re useable in that way. Of course I needed to know not to replace certain keywords that pertained to the javascript or css, and only replace them when they were referring to the actual elements, but that didnt take a genius to figure out...

So now I have a happy little tree displayed like so:

So now that I have that I am able to tackle the next set of problems. I need the content pane area to the right to change depending on what is selected from tha tree. The example from the site doesnt go this far, only as far as getting the tree to display the way you want it to... This is how the tree is displayed.

First I had to create a DTD file to specify the branches of the tree:

Then I have my xml file that contains all my elements and is where the tree gets its data from:

The dtd tells the tree to pull the root node from the <name> element, and then put each <device> element below that. I still have to alter both of the above code samples, but the idea is there.

I have javascript to control the tree, as well as css for styling, but I dont really think they are needed for this thread. Then I have the my XSLT to transform my xml to html form:

Then I just embed the tree into my xhtml page and it displays just fine.

A lot of lead up to my questions, I know ,but I cant think of a way to simplify this.

So my first question, as I said I need to have whatever node a user clicks on from the tree manipulate what will show up in the content pane. With a richfaces tree, you just add some type of actionEvent atribute to the <treeNode> tag. But my xhtml pages only contain javascript and insert statements. I am sure that this is not where this will be handled.

So my first question is, where would this even be handled in the code from above? It would seem to me that it would have to be in the xsl code right? But this is my first time working with xsl so Im not really sure. Any tips to get me started in the right direction would be great.

My second question I think i will start a new post for, because this one is already so long I doubt anyone is gong to want to read through it in the first place lol. Ill post the link tho the second question in a bit, but it is pretaining to editing the DTD to allow me to include other elements that will not be part of the tree. I'm sure it is a simple keyword I need to add in but I have no experience with DTD other than this right now either.

Thanks if you read through this at least
Nothing up my sleeve ... and ... presto! A tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
    Bookmark Topic Watch Topic
  • New Topic