Hi,

I know this is really js related but I figured it is an xsl problem so I'd post it here and see how it went.

I need to change the value of two <xsl:param>s. I have tried using selectSingleNode, and it worked for a while, then I went and changed the xsl and now it doesnt work.

So I have to pass params to an xsl stylsheet using the following js

<script language="javascript">
var HTMLresults;
var xml;
var xsl;
var sortParam;
var dtParam;
var column;
var dt;
var processor;

function loadXML() {
xml = new ActiveXObject("Microsoft.XMLDOM");
xml.async = false;
xml.load("xmlsorttest.xml");

xsl = new ActiveXObject("MSXML2.FreeThreadedDomDocument.3.0");
xsl.async = false;
xsl.load("test12.xsl");

var template = new ActiveXObject("MSXML2.XSLTemplate")
>> template.stylesheet = xsl;
processor = template.createProcessor();
processor.input = xml;


if(xsl.parseError.errorCode != 0) {
showError();
}//if

if(document.forms[0].SortVal.value != 0) {
column = document.forms[0].SortVal.value;
if(column == "EnterBy"){
dt = "text";
}else{
dt = "number";
}//if
processor.addParameter("sortby", column);
processor.addParameter("datatype", dt);
}//if
//transform
doTransform();
}//loadxml

function doTransform(){
if (getReadyState()){
//resulting = xml.transformNode(xsl);
processor.transform();
resulting = processor.output;
document.all.item("HTMLresults").innerHTML = resulting;
}//if
}//doTransform

function getReadyState(){
if(xml.readyState == 4){
return true;
}//if
setTimeout("getReadyState()", 100);
}//getReadyState



ShowError() is a js that prints out the error.

SortVal is a hidden field in the HTML that contains the js.

loadXML() is called in the <BODY> tag onload.

The params exist in the stylesheet:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:param name="sortby">DateVal</xsl:param>
<xsl:param name="datatype">number</xsl:param>
........
........
........
My problem is that I get a run time error "The stylesheet does not contain a document element. Stylesheet is empty or not well formed" when I open the html page.

The error occurs where I have indicated ">>" in the above js.

I have checked the style in XMLSpy and it says it is well formed. Additonally I can open the xml file and the style works fine.

So the style must be empty due to a coding error. Any ideas as to what is wrong with my code?