[xsl] Opening XSL output in a new window through browser

Subject: [xsl] Opening XSL output in a new window through browser
From: "Vishnu Vardhan P" <pv.vardhan@xxxxxxxxx>
Date: Thu, 17 May 2007 15:37:28 -0400
Hi All,

I am using XSL and Javascript for rendering an HTML page. The dynamic
page depends on the user selection of menu(Menu is written in
javascript). I am passing the selected menu value from Javascript to
XSL for page rendering. The value has been passed successfully to XSL
and I can see the result.

Please see the below code..
function SelectedMenu(menu_selected, toplevel)
{
  Menu_Selection = toplevel;
  try
  {
   if(toplevel != 1)     // If toplevel=1 it should not go anywhere
   {
    var xslt = new ActiveXObject(" Msxml2.XSLTemplate");
    var xslDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument");
    var xslProc;
    xslDoc.async = false;
    xslDoc.resolveExternals = false;
    xslDoc.load ("example.xsl");
    xslt.stylesheet = xslDoc;
    var xmlDoc = new ActiveXObject("Msxml2.DOMDocument");
    xmlDoc.async = false;
    xmlDoc.resolveExternals = false;
    xmlDoc.load ("installedtools.xml");
    xslProc = xslt.createProcessor();
    xslProc.input = xmlDoc;
    xslProc.addParameter("menuselected", Menu_Selection);
    xslProc.transform();
    document.write (xslProc.output);
   }
  }
  catch(e)
  {
      alert(e.description);
  }
}

and XSL code is as follows..

  <xsl:output method="html"/>
   <xsl:param name="menuselected"/>
       <xsl:template match="/">

and somewhere in the code I am using menuselected variable as follows.

<xsl:for-each select="/ServiceConsole/Tool">
 <xsl:if test="Id=$menuselected">

Based on the menuselected value particular page details will display.

If I click on menu link the result is fine.The problem is that, if I
open link in another window through browser functionality "Open in New
Window" I am not able to see the result. Somehow I pointed out the
problem is because of document.write. If I remove that stement from js
file the result is completely gone. not even seen in the same page
itself.

Can any one please help me to fix this issue. I am very much thankful
if any one could point out the problem and let me know the process.

Thanks
Vishnu

Current Thread