函数"fn:encode-for-uri"导致XSLT错误

Ev.*_*Ev. 4 xml xslt

我需要URL在XSLT中编码一个字符串,但函数:

fn:encode-for-uri
Run Code Online (Sandbox Code Playgroud)

打破脚本.我在网上查了一下,显然它是命名空间的一部分

http://www.w3.org/2005/xpath-functions
Run Code Online (Sandbox Code Playgroud)

所以我将以下行添加到我的XSLT文件的顶部无济于事.

xmlns:fn="http://www.w3.org/2005/xpath-functions" 
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?我在Visual Studio中逐步完成它,我得到了异常:

Cannot find a script or an extension object associated with namespace 'http://www.w3.org/2005/xpath-functions'.
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

-ev

Dim*_*hev 9

Visual Studio使用.NET XSLT处理器 - 即XSLT 1.0处理器.

函数编码换URI()是只在的XPath 2.0/XQuery的标准功能.XSLT 1.0处理器仅使用XPath 1.0,并且该encode-for-uri()功能未实现和可用.

要使用此功能,您需要一个XSLT 2.0处理器,例如Saxon.NET或XQSharp.