2

这是我的 XSL:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:r="my-own-namespace"
  version="2.0" exclude-result-prefixes="xs">
  <xsl:template match="/">
    <xsl:value-of select="r:foo('test')"/>
  </xsl:template>
  <xsl:function name="r:foo">
    <xsl:value-of select="$val"/>
  </xsl:function>
</xsl:stylesheet>

这就是 Xalan 2.7.1(从 Java 中使用)所说的:

(Location of error unknown)java.lang.NoSuchMethodException: For extension 
function, could not find method 
org.apache.xml.utils.NodeVector.foo([ExpressionContext,] ).

是关于什么的?如何解决问题?

4

1 回答 1

3

AFAIK Xalan 仅实现 XSLT 1.0,并且xsl:function是 XSLT 2.0。您应该使用 XSLT 2.0 处理器,例如saxon

于 2011-05-26T16:53:58.800 回答