wood burning stoves 2.0*
The moose likes XML and Related Technologies and the fly likes Have a tree displayed using javascript, xml, xslt - need help with action events for the nodes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Have a tree displayed using javascript, xml, xslt - need help with action events for the nodes" Watch "Have a tree displayed using javascript, xml, xslt - need help with action events for the nodes" New topic
Author

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

Matt Kohanek
Village Idiot
Ranch Hand

Joined: Apr 04, 2009
Posts: 483

Well I was able to get a tree to display taking the example from this site:

http://www.devx.com/getHelpOn/Article/11874/0/page/6

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


True wisdom is in knowing you know nothing - Socrates
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Have a tree displayed using javascript, xml, xslt - need help with action events for the nodes
 
Similar Threads
xsl: anchor problem
Transforming URL
XSL fails with xmlns
Editing dtd file to allow certain elements but not use them in a tree display.
[XSL-FO][docbook]Problem print line in table of contents