views:

632

answers:

5

I have an XML file:

<root>
  <foo>
    <!--Content Here-->
  </foo>
</root>

Now I want generate an HTML file from it. The HTML has two vertical frames. The left one displays the treeview of the XML file. And I want the right one display content of the tree view: when I click on the "foo" node, the content will be displayed on the right.

Now I have written an XSL file to get a treeview and an HTML file which has:

<html>
<head>
<script language="javascript">
function populateFrames(){
    var x = new ActiveXObject("Microsoft.XMLDOM");
    var s = new ActiveXObject("Microsoft.XMLDOM");
    x.async = false
    s.async = false
    x.load("source.xml");
    s.load("tree.xsl");
    var html = x.transformNode(s);
    var destination = document.frames("header").document.open("text/html","replace");
    destination.write(html);
}
</script>
</head>

<frameset onload="populateFrames()" cols="25%,*">
  <frame name="header" scrolling="auto" target="main">
  <frame name="main">
</frameset>
</html>

As you can see, the tree will display in the "header" frame, and I want the content in the "main" frame.

Could anyone tell me how to do this? It's very urgent: I'm waiting on line. Thanks very much for your help.

A: 

In "tree.xsl", I would render out the content HTML as a hidden element for each tree node. Then when a tree node is clicked, use your last 2 lines of javascript to open the 2nd content frame and write out the corresponding content HTML.

David
Could u please explain a little more in detail? Thank u
A: 

I give the XSL file here:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"         xmlns:fo="http://www.w3.org/1999/XSL/Format"&gt;

<xsl:output method="html"/>

<xsl:template match="/">
<html>
<head>
  <!-- Some JS code to deal with the "expand", "collapse"... sth like these-->
</head>
<body>
  <table border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td>
        <a onclick="toggle(this)"><img src="plus.gif"/><img src="folder.gif"/>root</a>
        <div style="display:none;">
          <table border="0" cellpadding="0" cellspacing="0">
            <tr>
       <td width="15"></td>
              <td>
                <a><img src="page.gif"/>Foo</a>
              </td>
            </tr>
          </table>
        </div>
      </td>
    </tr>
  </table>
</body>
<html>
</xsl:template>
</xsl:stylesheet>
A: 

i wrote a js function in the tree.xsl:

//Display the contents of element in main frame
function display(elem){
var x = new ActiveXObject("Microsoft.XMLDOM");
var s = new ActiveXObject("Microsoft.XMLDOM");
x.async = false
s.async = false
x.load("source.xml");
s.load("Foo.xsl");
var html = x.transformNode(s);
var destination = document.frames("main").document.open("text/html","replace");
    destination.write(html);
}

To use the Foo.xsl which has a template for displaying the content of Foo, and then call the function when click on the node. But it doesn't work. Could anyone give me some sugguestion?? Thanks

A: 

Could anybody please help me?? Thanks

A: 

Hi,

Was this done?

I have similar requirement can you please email me the steps followed to solve this?

Email : [email protected]

Thanks, Anitha