how can <iframe> with transformed xml comunicate with web page

i have a problem with transformed xml

everithing went as planned until i tryed to get a value of a variable named SelectedLeafID from a tree.htm.
Variable is defined inside a xmltree.js.
xmltree.xls uses that script and function SelectedLeaf_Changed changes the value of SelectedLeafID.
but tree.htm can't read its value.
Why not ??? and  "Is there a way to do that?"

here are the files

-----------------------  tree.xml ----------------------------------
<?xml version="1.0" ?>
<!DOCTYPE tree SYSTEM "tree.dtd">
<?xml-stylesheet type="text/xsl" href="xmlTree.xsl"?>
      <branch id="B1">
            <leaf id="L1">
            <leaf id="L2">
      <branch id="B2">
            <leaf id="L3">
            <branch id="B3">
                  <leaf id="L4">
                  <leaf id="L5">
            <leaf id="L6">
<?xml version="1.0"?>
      xmlns:xsl="" version="1.0">
<xsl:output method="html"></xsl:output>
<xsl:template match="/">
      <title>XML Tree Control</title>
      <link rel="stylesheet" type="text/css" href="xmlTree.css"/>
      <script type="text/javascript" src="xmlTree.js"></script>
<xsl:template match="tree">
<xsl:template match="branch">
   <span class="trigger">
   <xsl:attribute name="onClick">showBranch('<xsl:value-of select="@id"/>');</xsl:attribute>
   <img src="closed.gif">
      <xsl:attribute name="id">I<xsl:value-of select="@id"/></xsl:attribute>
   <xsl:value-of select="branchText"/>
   <span class="branch">
   <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
<xsl:template match="leaf">
      <img src="doc.gif"/>
      <span class="leaf">
      <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
      <xsl:attribute name="onClick">SelectedLeaf_Changed('<xsl:value-of select="@id"/>');</xsl:attribute>      
      <xsl:value-of select="leafText"/>
<!-- avoid output of text node  with default template -->
<xsl:template match="branchText"/>
   var SelectedLeafID= null;
  var openImg = new Image();
   openImg.src = "open.gif";
   var closedImg = new Image();
   closedImg.src = "closed.gif";
   function showBranch(branch){
      var objBranch = document.getElementById(branch).style;
      swapFolder('I' + branch);
   function swapFolder(img){
      objImg = document.getElementById(img);
         objImg.src = openImg.src;
         objImg.src = closedImg.src;

   function SelectedLeaf_Changed(xleafID)
   if (SelectedLeafID!=null)document.getElementById(SelectedLeafID).className="leaf";
    var lf = document.getElementById(xleafID);
    SelectedLeafID = xleafID;
      font: 10pt Verdana,sans-serif;
      color: navy;
      cursor: hand;
      display: block;
      display: none;
      margin-left: 16px;
      cursor: hand;
       <title>XML Tree Control</title>
       <script language="javascript" src="xmltree.js"></script>
  <form name="form1" id="form1" method="post" action="">
      <iframe id="tree" src="tree.xml" value="" STYLE="POSITION:RELATIVE" ></iframe>
      <input type="button" name="cmd" id="cmd" value="value" onclick="alert(SelectedLeafID);">
you will also need three images called:

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

BigGreenClenaMachineAuthor Commented:
you also need tree.dtd

   <!ELEMENT tree (branch+)>
   <!ELEMENT branch (branchText,(branch|leaf)*)>
   <!ELEMENT branchText (#PCDATA)>
   <!ELEMENT leaf (leafText)>
   <!ELEMENT leafText (#PCDATA)>
The xml is loaded into the iframe. You therefore have to use the name of the iframe when referring to the variable.

     <input type="button" name="cmd" id="cmd" value="value" onclick="alert(tree.SelectedLeafID);">


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.