I am trying to send URL parameters from an HTML page to an XSL page.
I used this script to pass parameters manually to the XSL and it works
great. I just modified the "input for XSL-processor" section:
http://www.biglist.com/lists/xsl-lis.../msg00002.html
However, I'd like to be able to build that parameter list dynamically.
So far, I can get the parameters into an array and pass the values to
the loadXML function; however, I cannot get the script to write the
list of parameters and send them to XSL.
I've included my two scripts below. getURLparameter s() extracts the URL
parameters and loadXML() loads the XML/XLS pages.
Any thoughts?
Thanks,
BC
////////////////////////////////////
function getURLparameter s() {
var parameterArray =
unescape(self.l ocation.search) .substring(1).s plit("&");
if (self.location. search.indexOf( "=") == -1) {
loadXML(paramet erArray)
return;
}
for (var i=0;i<parameter Array.length;i+ +) {
parameterArray[i] = parameterArray[i].split("=");
}
loadXML(paramet erArray);
}
////////////////////////////////////
function loadXML(paramet erList) {
// Load your XSL
var objXSLT = new ActiveXObject(" MSXML2.FreeThre adedDomDocument ")
objXSLT.async = false
objXSLT.load("m yxslpage.xsl")
// create a compiled XSL-object
var objCompiled = new ActiveXObject(" MSXML2.XSLTempl ate")
objCompiled.sty lesheet = objXSLT.documen tElement
// create XSL-processor
var objXSLProc = objCompiled.cre ateProcessor()
// Load your XML
var objXML = new ActiveXObject(" MSXML2.FreeThre adedDomDocument ")
objXML.async = false
objXML.load("my xmlpage.xml")
// input for XSL-processor
objXSLProc.inpu t = objXML
// build list of URL parameters and send to XSL
for (i = 0;i < parameterList.l ength;i++)
{
eval(objXSLProc .addParameter(p arameterList[i][0],
parameterList[i][1]));
alert(parameter List[i][0] + " = \"" + parameterList[i][1] + "\";");
}
// transform
objXSLProc.tran sform()
// display
document.write( objXSLProc.outp ut)