2010-01-20 137 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