How to use XSL functions with Xalan?
This is my 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>
This is what Xalan 2.7.1 (used from Java) is saying:
(Location of 开发者_JAVA技巧error unknown)java.lang.NoSuchMethodException: For extension
function, could not find method
org.apache.xml.utils.NodeVector.foo([ExpressionContext,] ).
What is is about? How to solve the problem?
AFAIK Xalan implements only XSLT 1.0, and xsl:function
is XSLT 2.0. You should use an XSLT 2.0 processor, such as saxon
精彩评论