这是我的 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,] ).
这是关于什么的?如何解决问题?
最佳答案
AFAIK Xalan 仅实现 XSLT 1.0,而 xsl:function
是 XSLT 2.0。您应该使用 XSLT 2.0 处理器,例如 saxon
关于java - 如何将 XSL 函数与 Xalan 一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6141908/