开发者

How to use XSL functions with Xalan?

开发者 https://www.devze.com 2023-03-08 10:00 出处:网络
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\"

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

0

精彩评论

暂无评论...
验证码 换一张
取 消