I have an html document and an XSLT currently. The XML that I need to parse is on a different remote server. Now, the XSLT works without issue as does the HTML document with XMLDOM if the XML file is hosted on the same server, however, when I try to call a remote file it doesnt work. Here is my HTML code with JS:
Really, I need to use my variable vURL as the source document for the XML data as I need the variables passed through the URL. I tried using src_doc.load(vU RL) as well but still no go.
Code:
<head>
<script>
function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if (pair[0] == variable) {
return pair[1];
}
}
alert('Query Variable ' + variable + ' not found');
}
</script>
</head>
<html>
<body>
<script type="text/javascript">
var1 = getQueryVariable("var1");
var2 = getQueryVariable("var2");
vURL = 'http://xml.mywebserver.com/Userid=' + var1 + '&Password=' + var2;
</script>
<script type="text/javascript">
var processor = new XSLTProcessor();
var xslt = document.implementation.createDocument("", "", null);
xslt.async = false;
xslt.load("transform.xsl");
processor.importStylesheet(xslt);
var src_doc = document.implementation.createDocument("","", null);
src_doc.async = false;
src_doc.load("http://xml.mywebserver.com");
var result = processor.transformToDocument(src_doc);
var xmls = new XMLSerializer();
var output = xmls.serializeToString(result);
document.write(output);
}
</script>
</body>
</html>
Comment