views:

79

answers:

2

Hello everyone.

I want to generate a treeview from xml by xsl. In the output html, there are 2 frames: treeframe for the treeview and contentframe for displaying the content of the nodes when I click on the tree.

I wrote a tree.xsl to generate the tree from the xml, a result.html who constructs the frameset and has js function, populateFrames() to automatically do the transformation and output it in the treeframe.

I also wrote a content.xsl file to extract the content of each specified node, and a content.js file who has the function, displayContent to do the transformation of xml by content.xsl.

Then in the tree.xsl, in the onclick event, I call the displayContent function.

My problem is here. I don't know how to set the target, to the contentframe. Can I do this in the tree.xsl or it'll be better to do it in the content.js or there are other solutions.

Thank you for your help.

Allen

+1  A: 

Put displayContent function in the containing page code rather than in HTML for the Tree frame. Have the nodes call top.displayContent. Now the displayContent can instruct the content frame with the URL it needs to display.

Alternatively use anchors in the XSL and specify the target attribute to point at the content frame.

AnthonyWJones
A: 

I have tried the second one, like

<a onclick="displayContent('a','b')" target="parent.contentframe"><img src="page.gif"/>Foo</a>

But it doesn't work. What should I do with the transformation output in the content.js? What I did is:

var Result = xslProc.output;
var Destination = document.open("text/html","replace");
Destination.write(Result);
The output of displqyContent always appears in the treeframe