Hello!
I've got the following code from the w3 school website for phrasing my xml and xsl. It is inside the Head tag of the HTML doc. (not an external linked file)
Quote:
<script type="text/javascript">
function loadXMLDoc(fname)
{
var xmlDoc;
// code for IE
if (window.ActiveXObject)
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
}
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument)
{
xmlDoc=document.implementation.createDocument("","",null);
}
else
{
alert('Your browser cannot handle this script');
}
xmlDoc.async=false;
xmlDoc.load(fname);
return(xmlDoc);
}
function displayResult()
{
xml=loadXMLDoc("JobNumbers.xml");
xsl=loadXMLDoc("joblist.xsl");
// code for IE
if (window.ActiveXObject)
{
ex=xml.transformNode(xsl);
document.getElementById("example").innerHTML=ex;
}
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument)
{
xsltProcessor=new XSLTProcessor();
xsltProcessor.importStylesheet(xsl);
resultDocument = xsltProcessor.transformToFragment(xml,document);
document.getElementById("example").appendChild(resultDocument);
}
}
</script>
|
The above script works fine, but when I want to point the links to the same files in a different directory, it doesn't work.
EG
Quote:
xml=loadXMLDoc("../xml/JobNumbers.xml");
xsl=loadXMLDoc("../xml/joblist.xsl");
|
I'm sure I've got the right relative path from the HTML file. Absolute links don't work either
Quote:
xml=loadXMLDoc("/site/xml/JobNumbers.xml");
xsl=loadXMLDoc("/site/xml/joblist.xsl");
|
Anyone got any ideas? Thanks very much.