Embed the Tree in an HTML Document
In most cases, the tree control will be a component in another Web page. The transformation above creates the tree for viewing in a browser but, usually, you'll want to surround the tree with other content.
Both IE and N7 use the same mechanism for embedding external contentthe
<iframe> element. Here's a simple method for embedding the tree in another page:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Embedded XML Tree Control</title>
<style type="text/css">
#tree{
border-right:1px black solid;
border-top: none;
border-bottom: none;
border-left:none;
position: absolute;
top:10;
left:0;
width: 150;
}
#content{
position:absolute;
top:0;
left: 160;
font-family: sans-serif;
color: navy;
}
</style>
<script type="text/javascript">
function setHeight(){
var availableHeight = 0;
if(document.all)
availableHeight = document.body.clientHeight;
else
availableHeight = innerHeight;
var tree = document.getElementById('tree').style;
tree.height = availableHeight-20;
}
</script>
</head>
<body onload="setHeight()">
<iframe id="tree" src="tree.xml"></iframe>
<div id="content">
<h2>Page Content Here</h2>
</div>
</body>
</html>
In my opinion, Mozilla renders this HTML file correctly but IE doesn't. IE insists on displaying a scrollbar for the
<iframe>even when it isn't necessary.
I've barely scratched the surface of XSLT and XPath. There are tomes of information on the subject. I advise you to inform yourself through whatever means available to you on XML and its accompanying technologies.
The good news is that the solution I've implemented here will work for any XML document that adheres to the tree DTD. Because the implementation breaks the tree into smaller, more manageable pieces, the tree control is both maintainable and extensible. The solution also allows you to concentrate on the content of the treefreeing you from the underlying complexity. Finally, the solution works in both of the major browsers currently available.