2011-02-17 84 views
2

我有两台服务器,我的测试服务器“服务器1”在线,没有防火墙。服务器2(生产)位于防火墙后面。下面是提供以下错误的代码:命名空间'http://exslt.org/common'不包含任何功能 此错误仅在服务器2上显示。如果我尝试在任一浏览器上浏览到http://exslt.org/common,页面不是那里。命名空间'http://exslt.og/common'错误

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:ext="http://exslt.org/common" 
xmlns:my="my:my" extension-element-prefixes="ext my"> 

我从一个非常乐于助人的人上了计算器上面的代码,我95%是工作在Serer2但我现在刚刚起步的错误。其余的代码如下:请帮助我拉我的头发哈哈。

<?xml version="1.0" encoding="ISO-8859-1"?> 

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:ext="http://exslt.org/common" 
xmlns:my="my:my" extension-element-prefixes="ext my"> 

<my:colors> 
    <c>#fff</c> 
    <c>#ccc</c> 
</my:colors> 

<xsl:variable name="vColors" select="document(\'\')/*/my:colors/*"/> 

<xsl:template match="NewDataSet"> 
     <html> 
      <body> 
      <table width="390" style="text-align:left;" cellspacing="0"> 
          <tr> 
          <th style="text-align:left;"><span style="font:20px arial; 
font-weight:bold;">Agent Name!</span></th> 
          <th style="text-align:center;"><span style="font:20px arial; 
font-weight:bold;">State</span></th> 
          <th style="text-align:center;" ><span style="font:20px arial; 
font-weight:bold;">Time</span></th> 
          </tr> 

       <xsl:variable name="vrtfResult"> 
       <xsl:apply-templates> 
        <xsl:sort select="time" data-type="number" order="descending"/> 
       </xsl:apply-templates> 
       </xsl:variable> 

       <xsl:apply-templates select="ext:node-set($vrtfResult)/tr"/> 
      </table> 
      </body> 
     </html> 
</xsl:template> 

<xsl:template match="tr"> 
    <xsl:variable name="vPos" select="position()"/> 
<xsl:copy> 
    <xsl:copy-of select="@*"/> 
    <xsl:attribute name="bgcolor"> 
    <xsl:value-of select="$vColors[($vPos mod 2)+1]"/> 
    </xsl:attribute> 

    <xsl:copy-of select="node()"/> 
</xsl:copy> 
</xsl:template> 

<xsl:template match="AgentSales[State=\'Talking Out\']"> 
    <tr> 
     <xsl:apply-templates/> 
    </tr> 
</xsl:template> 

     <xsl:template match="AgentSales/AgentName"> 
      <td style="text-align:left;"> 
       <span style="font:14px arial; 
font-weight:bold;text-align:center;"> <xsl:value-of 
select="."/></span> 
      </td> 

     </xsl:template> 

     <xsl:template match="AgentSales/State"> 
      <td style="text-align:center;"> 
       <span style="font:14px arial; 
font-weight:bold;text-align:center;"> <xsl:value-of 
select="."/></span> 
      </td> 

     </xsl:template> 

     <xsl:template match="AgentSales/time"> 
      <td style="text-align:center;"> 
       <span style="font:14px arial; 
font-weight:bold;text-align:center;"> <xsl:value-of 
select="."/></span> 
      </td> 

     </xsl:template> 

    <xsl:template match="AgentSales/Reason | AgentSales"/> 
</xsl:stylesheet> 
+1

问题是您正在使用必须由您的XSLT处理器实现的扩展函数。大多数情况下,每个XSLT处理器都实现`node-set()`扩展功能,但它们可能在所选的命名空间URI中不同。其他的方法是使用推式风格,就像在我的答案中为你自己的问题http://stackoverflow.com/questions/4464490/rotate-tr-background-color-without-using-for-each/4466261#4466261 – 2011-02-17 20:00:27

回答

1

你的问题是这是一个OV的服务器上运行的XSLT处理器实现EXSLT的node-set()扩展功能,而其他XSLT处理器(在其他服务器上运行)未实现此扩展功能。

如果可能,解决方案是在两台服务器上使用相同的XSLT处理器。

如果不能这样做,找出所支持的第二台服务器上xxx:node-set()扩展功能的命名空间(和名称),并替换:

xmlns:ext="http://exslt.org/common" 

xmlns:ext="{the-exact-namespace-to-be-used-for-this-XSLT-processor}"