Win a copy of Spring Boot in Practice this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

passing a parameter to xsl from javascript

 
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic