为了使用xpath-functions(特别是fn
部分),我包括各个命名空间到我的XSLT样式表,像这样:如何在XSLT 2.0中使用xpath-functions?
<xsl:stylesheet
version="2.0"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
>
如specified由W3C。
然而,当我使用fn:document-uri
,我的XSLT引擎告诉我,我叫一个未知函数/扩展:
<xsl:variable name="uri" select="fn:document-uri()" />
歌剧院说:
This document had an invalid XSLT stylesheet. Error message from the XSLT engine:
Error: XPath expression compilation failed: fn:document-uri()
Details: compilation error (characters 1-17, "fn:document-uri()"): unknown function called: '{ http://www.w3.org/2005/xpath-functions , document-uri }'
火狐说:
由于xslt 2.0,Error during XSLT transformation: An unknown XPath extension function was called.
和xsltproc
拒绝转换。
那么,如何正确指定fn
命名空间呢?
位掩码有用,没我的回答提供的信息你后,还是你仍然有问题,对此有何看法? – 2012-04-11 02:45:03
@DimitreNovatchev:技术上你有,但一个解决方法会很好(虽然我不认为这是可能的)。这就是为什么我把这个问题延长了一段时间。 – bitmask 2012-04-11 08:06:35
我明确表示符合*的* XSLT 1.0处理器*不能*实现XPath 2.0函数。这很明显意味着没有“解决方法” - 如果在XSLT中需要XPath 2.0,那么它们必须使用XSLT 2.0(或更高版本)处理器。 – 2012-04-11 11:39:11