I'm working on an a clientside xslt using jscript that passes a parameter to the xsl. I've got it working no problem in IE but cant get it to work in Mozilla. Can anyone help?
This is my IE code -
Expand|Select|Wrap|Line Numbers
- <html>
- <head>
- <title>CEL Learning</title>
- <script language="JScript">
- <!--
- //Applies the XSLT transformation and returns a string
- //containing transformed text
- function applyXSLT(xmlFileName, xslFileName)
- {
- var objXML;
- var objXSLT;
- objXML = new ActiveXObject("MSXML2.DOMDocument.3.0");
- objXML.async = false;
- objXML.validateOnParse = false;
- objXSLT = new ActiveXObject("MSXML2.DOMDocument.3.0");
- objXSLT.async = false;
- objXSLT.validateOnParse = false;
- try
- {
- //Load XML and XSLT documents
- objXML.load(xmlFileName);
- objXSLT.load(xslFileName);
- return objXML.transformNode(objXSLT)
- }
- catch(e)
- {
- //error handling
- }
- }
- //Applies the XSLT transformation and returns a string
- //containing transformed text
- //Allows passing a single parameter to the stylesheet
- function applyXSLTWithParam(xmlFileName, xslFileName, paramName, paramValue)
- {
- var objXML;
- var objXSLT;
- var objxsltTemplate;
- var objxsltProcessor;
- try
- {
- objXML = new ActiveXObject("MSXML2.DOMDocument.3.0");
- objXML.async = false;
- objXML.validateOnParse = false;
- objXSLT = new ActiveXObject("MSXML2.FreeThreadedDOMDocument.3.0");
- objXSLT.async = false;
- objXSLT.validateOnParse = false;
- //Load XML and XSLT documents
- objXML.load(xmlFileName);
- objXSLT.load(xslFileName);
- objxsltTemplate = new ActiveXObject("MSXML2.XSLTemplate.3.0");
- objxsltTemplate.stylesheet = objXSLT;
- objxsltProcessor = objxsltTemplate.createProcessor();
- objxsltProcessor.input = objXML;
- objxsltProcessor.addParameter(paramName, paramValue);
- objxsltProcessor.transform();
- return objxsltProcessor.output;
- }
- catch(e)
- {
- //error handling
- }
- }
- function GetEmpList()
- {
- lessonList.innerHTML = applyXSLT("topic.xml", "EmpForHTML1.xsl");
- }
- function showEmpDetails(pageID)
- {
- lessonContents.innerHTML = applyXSLTWithParam("topic.xml", "EmpForHTML2.xsl", "pageID", pageID);
- }
- -->
- </script>
- </head>
- <body onload="GetEmpList();">
- <table width="780" border="2">
- <tr height="60">
- <td><img src="nalspec.gif" alt="NALSpec" /></td>
- <td>  </td>
- <td><img src="cel.gif" alt="CEL" /></td>
- </tr>
- <tr height="350">
- <td colspan="3" ><div id="lessonContents" /></td>
- </tr>
- <tr height="40">
- <td><div id="lessonList" /></td>
- <td>  </td>
- <td><img src="footer.gif" alt="footer" /></td>
- </tr>
- </table>
- </body>
- </html>
Expand|Select|Wrap|Line Numbers
- <html>
- <head>
- <title>CEL Learning</title>
- <script language="JScript">
- //Applies the XSLT transformation and returns a string
- //containing transformed text
- function applyXSLT(xmlFileName, xslFileName)
- {
- oXmlDom.load(xmlFileName);
- oXslDom.load(xslFileName);
- var oResultDom = oProcessor.transformToDocument(oXmlDom);
- return oResultDom;
- }
- //Applies the XSLT transformation and returns a string
- //containing transformed text
- //Allows passing a single parameter to the stylesheet
- function applyXSLTWithParam(xmlFileName, xslFileName, paramName, paramValue)
- {
- oXmlDom.load(xmlFileName);
- oXslDom.load(xslFileName);
- var oProcessor = new XSLTProcessor()
- oProcessor.importStylesheet(oXslDom);
- oProcessor.setParameter(null, paramName, paramValue);
- var oResultDom = oProcessor.transformToDocument(oXmlDom);
- return oResultDom;
- }
- function GetEmpList()
- {
- lessonList.innerHTML = applyXSLT("topic.xml", "EmpForHTML1.xsl");
- }
- function showEmpDetails(pageID)
- {
- lessonContents.innerHTML = applyXSLTWithParam("topic.xml", "EmpForHTML2.xsl", "pageID", pageID);
- }
- -->
- </script>
- </head>
- <body onload="GetEmpList();">
- <table width="780" border="2">
- <tr height="60">
- <td><img src="nalspec.gif" alt="NALSpec" /></td>
- <td>  </td>
- <td><img src="cel.gif" alt="CEL" /></td>
- </tr>
- <tr height="350">
- <td colspan="3" ><div id="lessonContents" /></td>
- </tr>
- <tr height="40">
- <td><div id="lessonList" /></td>
- <td>  </td>
- <td><img src="footer.gif" alt="footer" /></td>
- </tr>
- </table>
- </body>
- </html>