<HTML>
<HEAD>
<TITLE>sample</TITLE>
<SCRIPT language = "javascript">
function init()
{
var basicinfo = new ActiveXObject("Msxml2.DOMDocument.4.0");
var employment = new ActiveXObject("Msxml2.DOMDocument.4.0");
var paycatagory = new ActiveXObject("Msxml2.DOMDocument.4.0");
var attendence = new ActiveXObject("Msxml2.DOMDocument.4.0");
var mainpage = new ActiveXObject("Msxml2.DOMDocument.4.0");
mainpage.async=false;
mainpage.validateOnParse=true;
basicinfo.async=false;
basicinfo.validateOnParse=true;
employment.async=false;
employment.validateOnParse=true;
paycatagory.async=false;
paycatagory.validateOnParse=true;
attendence.async=false;
attendence.validateOnParse=true;
// You can substitute other XML file names here.
try
{
mainpage.load("hello.xml");
errorValid(mainpage);
basicinfo.load("emp_M_Basicinfo.xml");
errorValid(basicinfo);
employment.load("emp_M_EmploymentInfo.xml");
errorValid(employment);
attendence.load("attendence.xml");
errorValid(attendence);
paycatagory.load("pay_M_CatagoryItem.xml");
errorValid(paycatagory);
}catch(e)
{
alert("error:");
}
//Display basicinfo nodeset
// alert(basicinfo.documentElement.childNodes.item(0).xml);
var xslt = new ActiveXObject("Msxml2.XSLTemplate.4.0");
var xsltTree= new ActiveXObject("Msxml2.FreeThreadedDOMDocument.4.0");
xsltTree.async = false;
// You can substitute other XSLT file names here.
xsltTree.load("hello.xslt");
xslt.stylesheet = xsltTree
xslProc = xslt.createProcessor();
xslProc.input = mainpage
try
{
xslProc.addParameter("basicinfo",basicinfo.documentElement);//.selectNodes("/Results")
xslProc.addParameter("employment",employment.documentElement);
xslProc.addParameter("paycatagory",paycatagory.documentElement);
xslProc.addParameter("attendence",attendence.documentElement);
xslProc.addParameter("yourname","William Wang");
}catch(e)
{
alert(e);
}
xslProc.transform();
resTree.innerHTML = xslProc.output;
// Save the result of the XSL transformation
//htmlCode = xslProc.output
//fso=new ActiveXObject("Scripting.FileSystemObject")
//htmlFile=fso.CreateTextFile("sample.html",true)
//htmlFile.WriteLine(htmlCode)
//htmlFile.Close()
}
function errorValid(errorObject)
{
if (errorObject.parseError.errorCode != 0)
{
var strErrMsg = "Problem Parsing Style Sheet:\n"
+ " Error #: " + errorObject.parseError.errorCode + "\n"
+ " Description: " + errorObject.parseError.reason + "\n"
+ " In file: " + errorObject.parseError.url + "\n"
+ " Line #: " + errorObject.parseError.line + "\n"
+ " Character # in line: " + errorObject.parseError.linepos + "\n"
+ " Character # in file: " + errorObject.parseError.filepos + "\n"
+ " Source line: " + errorObject.parseError.srcText;
alert(strErrMsg);
}
}
</SCRIPT>
</HEAD>
<BODY onload = "init()" >
<div id="resTree"></div>
</BODY>
</HTML>