I have some doubts regarding XML and XSL transfornation using
javascript.Hope SomeOne will help me for solving this problem.
Actually i Created a javascript for transforming XML and XSL. i made
a new class in the javascript and i added the object of that
particular class and a namespace into the processor by using the
method processor.addOb ject(object,nam espace) . It works fine in
Internet Explorer. So that i could call a function of that object in
my xsl file xpath. the code for Internet Explorer is given below for
reference.
My problem is that when i come to FireFox or any Mozilla Browser, i am
not able to add an object into the XSLT processor of mozilla. So i
cant call any external functions inside my xsl file xpath. Could
anyone please help for doing the same. or any other techniques for
calling an external function in the xpath of the xsl file.(for
mozilla).
I will be very grateful to you.
Javascript for Internet Explorer :
/* xml-xsl-transformation-IE.js */
/
*---------------------------------------------------------------------------------
*/
function MyClass()
{
this.multiply=m ultiplyNow;
function multiplyNow(val 1,val2)
{
var val3=val1*val2;
return val3;
}
}
function parseFiles()
{
try
{
var elemTbl=documen t.getElementByI d("tblId");
var xmlIE=new ActiveXObject(" Microsoft.XMLDO M");
var xslIE=new ActiveXObject(" MSXML.FreeThrea dedDOMDocument" );
//Load the Script Synchronous with the page
xmlIE.async = false;
xmlIE.load("xml _js.xml");
xslIE.async = false;
xslIE.load("xsl _js.xsl");
var FnObj=new MyClass();
var xslTemplate=new ActiveXObject(" Msxml2.XSLTempl ate");
xslTemplate.sty lesheet=xslIE;
var Processor=xslTe mplate.createPr ocessor;
Processor.input =xmlIE;
Processor.addOb ject(FnObj, "urn:my-java-function" );
Processor.trans form();
//var docIE=xmlIE.tra nsformNode(xslI E);
elemTbl.innerHT ML=Processor.ou tput;
}
catch(f){alert( f.message)}
}
/
*---------------------------------------------------------------------------------
*/
Thanking You
Shidhin.C.R
javascript.Hope SomeOne will help me for solving this problem.
Actually i Created a javascript for transforming XML and XSL. i made
a new class in the javascript and i added the object of that
particular class and a namespace into the processor by using the
method processor.addOb ject(object,nam espace) . It works fine in
Internet Explorer. So that i could call a function of that object in
my xsl file xpath. the code for Internet Explorer is given below for
reference.
My problem is that when i come to FireFox or any Mozilla Browser, i am
not able to add an object into the XSLT processor of mozilla. So i
cant call any external functions inside my xsl file xpath. Could
anyone please help for doing the same. or any other techniques for
calling an external function in the xpath of the xsl file.(for
mozilla).
I will be very grateful to you.
Javascript for Internet Explorer :
/* xml-xsl-transformation-IE.js */
/
*---------------------------------------------------------------------------------
*/
function MyClass()
{
this.multiply=m ultiplyNow;
function multiplyNow(val 1,val2)
{
var val3=val1*val2;
return val3;
}
}
function parseFiles()
{
try
{
var elemTbl=documen t.getElementByI d("tblId");
var xmlIE=new ActiveXObject(" Microsoft.XMLDO M");
var xslIE=new ActiveXObject(" MSXML.FreeThrea dedDOMDocument" );
//Load the Script Synchronous with the page
xmlIE.async = false;
xmlIE.load("xml _js.xml");
xslIE.async = false;
xslIE.load("xsl _js.xsl");
var FnObj=new MyClass();
var xslTemplate=new ActiveXObject(" Msxml2.XSLTempl ate");
xslTemplate.sty lesheet=xslIE;
var Processor=xslTe mplate.createPr ocessor;
Processor.input =xmlIE;
Processor.addOb ject(FnObj, "urn:my-java-function" );
Processor.trans form();
//var docIE=xmlIE.tra nsformNode(xslI E);
elemTbl.innerHT ML=Processor.ou tput;
}
catch(f){alert( f.message)}
}
/
*---------------------------------------------------------------------------------
*/
Thanking You
Shidhin.C.R
Comment