Hej igen - og tusind tak for dit svar. Det virker i IE! Jeg får umiddelbart en blank side i Firefox og en fejl, der refererer til parseren:
Error: Component returned failure code: 0x8060000e [nsIXSLTProcessor.transformToFragment] = <unknown>
Source file:
http://mydomain.com/jobliste.htmlLine: 45, som er denne: resultDocument = xsltProcessor.transformToFragment(xml,document);
Koden er:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="
http://www.w3.org/1999/xhtml"><head>
<script type="text/javascript" src="/files/scripts.js"></script>
<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("
http://link.to/xmlfile.xml");
xsl=loadXMLDoc("
http://link.to/xmlfile/style.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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test</title>
</head>
<body class="index" onload="displayResult()">
<div id="example"></div>
</body>
</html>
Jeg prøver lige at se om jeg kan gennemskue at lave de andre selects. Hvordan skal en udfør-knap se ud?