2012-06-22 4 views
0

Internet Explorer 9 및 Firefox 13에 몇 가지 문제가 있습니다. HTML, XSL 및 XML을 사용하여 웹 인터페이스를 구축 중이지만 제대로 작동합니다. 크롬, 오페라, 사파리를 변경하지 않고 Firefox 13과 Internet Explorer 9에서는 작동하지 않습니다. Firefox에서는 XML 값을로드 할 수없는 일부 페이지 (전부는 아님)가 Internet Explorer에서 가능하지 않습니다. XSLT를 사용하는 HTML 페이지에 대해 CSS를로드 할 수 있지만 모든 매개 변수를 올바르게로드 할 수 있습니다. 당신이 작동하지 않는 페이지의 예 (HTML, XML, XSL)XSLT는 Opera, Safari 및 Chrome에서 작동하지만 Firefox 13 및 Internet Explorer 9에서는 작동하지 않습니다.

HTML을 찾을 수 위

<html> 
<head> 
<script> 
function loadXMLDoc(dname) 
{ 
if (window.XMLHttpRequest) 
    { 
    xhttp=new XMLHttpRequest(); 
    } 
else 
    { 
    xhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
    } 
xhttp.open("GET",dname+"?id="+Math.random(),false); 
xhttp.send(""); 
return xhttp.responseXML; 
} 

function displayResult() 
{ 
xml=loadXMLDoc("sensorParameters.xml"); 
xsl=loadXMLDoc("sensorParameters.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> 
</head> 
<body onload="displayResult()"> 
<div id="example" /> 
</body> 
<head> 
<meta http-equiv="cache-control" content="no-cache"> 
</head> 
</html> 

XSL

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> 
<xsl:template match="/"> 
<html> 
    <head> 
      <title>Interface</title> 
      <link rel="stylesheet" type="text/css" href="style.css" /> 
    </head> 
    <body> 
    ... 
    (It continues, but it is not important...) 
    </body> 
</html> 
</xsl:template> 
</xsl:stylesheet> 

XML

<?xml version="1.0" encoding="ISO-8859-1"?> 
<?xml-stylesheet type="text/xsl" href="sensorParameters.xsl"?> 
<section1> 
<section2> 
      ......... some data 
</section2> 
<section3> 
      ......... some data 
</section3> 
      ......... 
</section1> 

도움이 될 것입니다. 감사합니다. ated. IE의 문제에 관해서는 마르코

+0

Firefox와 함께 실패한 최소한이지만 완전한 샘플에 URL을 게시하고 실패한 것을 자세히 설명 할 수 있습니까? 오류가 발생하면 정확히 어떤 오류가 발생합니까? –

+0

Saxon-CE는 브라우저 간 호환성의 문제를 대부분 해결할 것으로 기대합니다. –

+0

@ MartinHonnen 안녕 마틴, 귀하의 회신에 감사드립니다. 로컬로 작업 중이므로 URL을 게시 할 수 없습니다. XML 파일의 일부 값으로 채우려는 테이블이 있으면 Firefox에서로드 할 수 없습니다. 그러나 파이어 폭스를 사용하여 페이지의 소스를 살펴보면 파이어 폭스가 매개 변수를 올바르게로드하는 것을 볼 수 있지만 표시 할 수는 없습니다. – user1474456

답변

0

, 나는 다음 문제 중 하나 가능한 원인은 html 루트 요소와 완전한 HTML 문서, 스타일 시트에 linkhead 섹션을 만들 XSLT를 사용하는 접근 방식이라고 생각하지만, div 요소에 XSLT 결과를 포함하려고 시도합니다 (여기서 IE는 link을 무시합니다). 이 문제를 해결하려면 접근 방식을 변경하고 XSLT로 만든 head 요소에 link 요소를 추가해야합니다. 그러면 XSLT 변환 결과를 삽입합니다.

관련 문제