我想使用 EXSLT 库在 XSLT 1.0 中编写一个函数。这是我的样式表。
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:func="http://exslt.org/functions"
xmlns:my="http://www.example.com/">
<xsl:output method="text" encoding="UTF-8"/>
<func:function name="my:test">
<xsl:param name="param1" />
<xsl:param name="param2" />
<func:result select="concat($param1, $param2)" />
</func:function>
<xsl:template match="/">
<xsl:value-of select="my:test('test1', 'test2')" />
</xsl:template>
</xsl:stylesheet>
不幸的是,当我尝试执行它时,xsltproc
我收到以下错误。
{ http://www.example.com/ }test: 使用太多参数调用 xmlXPathCompiledEval: 1 个对象留在堆栈上。运行时错误:文件 exslt_function_test.xsl 第 16 行元素值 - XPath 评估未返回结果。
我没有看到任何错误。该函数是用两个参数定义和调用的。过去有没有人遇到过类似的问题?
删除任何不必要的评论...不,我不能使用 XSLT 2.0。