提出问题提出问题
 

建议的答复ActiveX warning with IE6 & IE7

  • 2008年9月24日 17:16ttvu 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     包含代码
    I try XSLT example at W3School http://www.w3schools.com/xsl/xsl_client.asp

    My textXSLT.html

    1 <html> 
    2 <head> 
    3 <script> 
    4 function loadXMLDoc(fname)  
    5 {  
    6   var xmlDoc;  
    7     
    8   if (window.ActiveXObject) // code for IE  
    9   {  
    10      xmlDoc=new ActiveXObject("Microsoft.XMLDOM");  
    11   }  
    12   else if (document.implementation   
    13            && document.implementation.createDocument) // code for Mozilla, Firefox, Opera, etc.  
    14   {  
    15      xmlDoc=document.implementation.createDocument("","",null);  
    16   }  
    17   else  
    18   {  
    19      alert('Your browser cannot handle this script');  
    20   }  
    21   xmlDoc.async=false;  
    22   xmlDoc.load(fname);  
    23   return(xmlDoc);  
    24 }  
    25  
    26 function displayResult()  
    27 {  
    28   xml=loadXMLDoc("http://www.w3schools.com/xsl/cdcatalog.xml");  
    29   xsl=loadXMLDoc("cdcatalog.xsl");  
    30     
    31   // code for IE  
    32   if (window.ActiveXObject)  
    33   {  
    34     ex=xml.transformNode(xsl);  
    35     document.getElementById("example").innerHTML=ex;  
    36   }  
    37   // code for Mozilla, Firefox, Opera, etc.  
    38   else if (document.implementation   
    39            && document.implementation.createDocument)  
    40   {  
    41     xsltProcessor=new XSLTProcessor();  
    42     xsltProcessor.importStylesheet(xsl);  
    43     resultDocument = xsltProcessor.transformToFragment(xml,document);  
    44     document.getElementById("example").appendChild(resultDocument);  
    45   }  
    46 }  
    47 </script> 
    48 </head> 
    49 <body id="example" onLoad="displayResult()">  
    50 </body> 
    51 </html> 

    I changed at line 28 which allows to load XML from http://www.w3schools.com/xsl/cdcatalog.xml

    and my XSL file

    <?xml version="1.0" encoding="ISO-8859-1"?>  
    <xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">  
     
    <xsl:template match="/">  
      <html> 
      <body> 
        <h2>My CD Collection</h2>   
        <table border="1">  
          <tr bgcolor="#9acd32">  
            <th align="left">Title</th>   
            <th align="left">Artist</th>   
          </tr> 
          <xsl:for-each select="catalog/cd">  
          <tr> 
            <td><xsl:value-of select="title" /></td>  
            <td><xsl:value-of select="artist" /></td>  
          </tr> 
          </xsl:for-each> 
      </table> 
      </body> 
      </html> 
    </xsl:template> 
     
    </xsl:stylesheet> 

    This example works correctly on IE6 & IE7, except I receive security warning message about active content. I'm afraid that if I use this code to transform XML from internet by XSLT, it always raise a warning popup.

    How can I get rid of this warning?

    Thanks for all your supports.

    ttvu

    • 已编辑ttvu 2008年9月24日 17:17
    • 已编辑ttvu 2008年9月25日 3:26
    •  

全部回复