No problems, another forum I used didn't allow its users to post code for some reason, that's all.
The JS file is:
function go()
{
if(document.implementation && document.implementation.createDocument)
{
// Mozilla
// Load XML
var xml = document.implementation.createDocument("", "", null);
xml.load("results.xml");
xml.onload = function()
{
// Load XSL
var xsl = document.implementation.createDocument("", "", null);
xsl.load("stylesheet.xsl");
xsl.onload = function()
{
xsltProcessor = new XSLTProcessor();
xsltProcessor.importStylesheet(xsl);
//Change parameter
xsltProcessor.setParameter(null, "fieldvalue", document.getElementsByName("fieldvalue")[0].value);
// Transform
result = xsltProcessor.transformToDocument(xml);
document.removeChild(document.firstChild);
document.appendChild(result.firstChild);
}
}
}
else if(window.ActiveXObject)
{
// IE
// Load XML
xml = new ActiveXObject("MSXML2.DOMDocument");
xml.async = false
xml.load("results.xml")
// Load XSL
xsl = new ActiveXObject("MSXML2.DOMDocument");
xsl.async = false
xsl.load("stylesheet.xsl")
//Change parameter
xsl.selectSingleNode("//xsl

aram[@name='fieldvalue']").setAttribute("select", "'"+document.forms[0].fieldvalue.value+"'")
// Transform
document.write(xml.transformNode(xsl))
}
else
{
// Browser unknown
alert("Browser unknown");
}
}
}
This file is accessed as soon as a user submits a form located on my website. The destination page is 'results.xml' and the value of the form I'm taking comes from the field named 'fieldvalue'.
The form works fine in IE but not in Firefox - it always returns the error:
Error: document.getElementsByName("fieldvalue")[0] has no properties
Which suggests to me it can't understand what 'fieldvalue' is. I don't understand this message, so I'm thinking there has to be a more practical way of doing this, rather than testing the browser then assigning a compatible solution.