xsltproc无法识别fx:function(任何更多)

时间:2016-06-06 13:02:06

标签: xslt debian exslt

我有一个奇怪的效果。我使用xalanj和xsltproc,我认为大多数脚本都适用于(两次)。但是,有一段时间,带有{http://exslt.org/functions}函数的xslt脚本在xsltproc中不再起作用。这是debian 7.9。

代码段

<xsl:transform version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:yz="http://www.hegny.de/xxyy"
    xmlns:fx="http://exslt.org/functions">

...
<fx:function name="yz:format3">
    <xsl:param name="x"/>
    <xsl:choose>
...

可以正常使用xalanj,但xsltproc会抱怨

compilation error: file /home/hegny/prog/syno_recording/xmltv_text.xsl line 67 element param
element param only allowed within a template, variable or param

(第67行是fx:function下的参数)

此外,调用xsltproc --dumpextensions时会显示

Registered XSLT Extensions
--------------------------
Registered Extension Functions:
...(nothing containing exslt.org/functions)...

Registered Extension Elements:
{http://exslt.org/functions}result
{http://xmlsoft.org/XSLT/}test
{http://exslt.org/common}document

Registered Extension Modules:
http://icl.com/saxon
http://xmlsoft.org/XSLT/
http://exslt.org/functions

将表明它知道fx:结果属于exslt函数的东西,但不是关于fx:function - 会有什么意义呢?有人发现如何让fx:function(返回?)工作? - 谢谢

1 个答案:

答案 0 :(得分:2)

要使用fx:function等扩展元素,请确保样式表声明扩展元素的命名空间,并在extension-element-prefixes="fx" xsl:stylesheet根元素上声明xsl:transform你的样式表。

相关问题