2010-01-20 82 views
1

我正在開發一個使用XSL轉換的Firefox擴展。在我需要從XSL樣式表執行 xsl:include之前,I 一直在使用XSLTProcessor,沒有問題。當我導入XSL樣式表 使用一個xsl:包括火狐提供了一個錯誤:從Firefox擴展運行代碼時,如果 我在「正常」運行xsl:include不能使用Firefox擴展

Error: Component returned failure code: 0x80600001 [nsIXSLTProcessor.importStylesheet] = Source file: chrome://myextension/content/functions.js Line: 632

這只是發生,HTML頁面的代碼完美工作。我也試着用xsl:import嘗試 並得到了相同的結果。我也嘗試使用絕對URI,如chrome:\\myextension\content\xsl\test2.xsl,並得到相同的錯誤。

有誰知道我會做錯什麼?在此先感謝

這裏去的代碼重現它(所有文件都在同一個文件夾中):

文件functions.js

function testXSL(){ 
     var processor = new XSLTProcessor(); 
     var xsl = document.implementation.createDocument("", "test", null); 
     xsl.addEventListener("load", onXSLLoaded, false); 

     xsl.load("test1.xsl"); 
     function onXSLLoaded() { 
      processor.importStylesheet(xsl); 
     } 
} 

文件test1.xsl

<?xml version="1.0" encoding="utf-8"?> 
<xsl:stylesheet version="1.0" 
       xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
       xmlns:xlink="http://www.w3.org/1999/xlink"> 

<xsl:include href="test2.xsl" /> 

</xsl:stylesheet> 

文件test2.xsl

<?xml version="1.0" encoding="utf-8"?> 
<xsl:stylesheet version="1.0" 
       xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
       xmlns:xlink="http://www.w3.org/1999/xlink"> 

    <xsl:template match="/"> 
       <h1>Included!!</h1> 
     </xsl:template> 

</xsl:stylesheet> 

回答

1

看來這是一個Firefox迴歸bug。我發現this one on Mozilla bugzilla。 恐怕沒有人可以幫助你,除非錯誤修補,並且沒有什麼好味道... 2年前開放,自6個月以來沒有更新。

+0

謝謝,我應該在發佈之前檢查bugzilla。讓我們希望這個錯誤得到一些關注。 – amercader 2010-01-20 17:39:58