• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

passing a parameter to xsl from javascript

 
amit sanghai
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using Javascript to transform xml using xsl. I am passing a parameter to the xsl from javascript.

Here is the script:

var xslname = "L401_View.xsl" ;
var xslt;
var xslDoc;
var xmlDoc;
var action = "Annuity" ;

xslt = new ActiveXObject("Msxml2.XSLTemplate.3.0") ;

xslDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.3.0");

xslDoc.async = false;
xslDoc.load(xslname);
if (xslDoc.parseError.errorCode != 0)
{
var myErr = xslDoc.parseError;
alert ("You have error " + myErr.reason);
}
else
{
xslt.stylesheet = xslDoc ;
xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0") ;
xmlDoc.async = false ;
xmlDoc.load('<%=xml.toString(responseXML).replaceAll("\\s\\s+|\\n|\\r", "")%>') ;
if (xmlDoc.parseError.errorCode != 0)
{
var myErr = xmlDoc.parseError ;
alert ("You have error " + myErr.reason) ;
}
}

xslProc = xslt.createProcessor() ;
xslProc.input = xmlDoc ;
xslProc.addParameter("insuranceProduct", action) ;
xslProc.transform() ;
document.write(xslProc.output) ;

Here, responseXML is the xml generated by the jsp which has this script.
I am getting an error: "Access is denied" at the line:
xslt.stylesheet = xslDoc ;

There is no error while parsing the XSL. Can anybody tell me why am I getting this error?

Thanks and regards,
Amit Sanghai.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic