函数“fn:encode-for-uri"导致 XSLT 出错 [英] Function "fn:encode-for-uri" causes XSLT to error

查看:26
本文介绍了函数“fn:encode-for-uri"导致 XSLT 出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在 XSLT 中对字符串进行 URL 编码,但函数:

I need to URL Encode a string in XSLT but the function:

fn:encode-for-uri

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

breaks the script. I checked it out online and apparently it's part of the namespace

http://www.w3.org/2005/xpath-functions

所以我在 XSLT 文件的顶部添加了以下行,但无济于事.

So i added the following line to the top of my XSLT file to no avail.

xmlns:fn="http://www.w3.org/2005/xpath-functions" 

有什么想法吗?我在 Visual Studio 中逐步完成,但出现异常:

Any ideas? I stepped through it in Visual Studio and I got the exception:

Cannot find a script or an extension object associated with namespace 'http://www.w3.org/2005/xpath-functions'.

有什么想法吗?

-Ev

推荐答案

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

Visual Studio uses a .NET XSLT processor -- that is XSLT 1.0 processor.

函数encode-for-uri() 是仅在 XPath 2.0/XQuery 中的标准函数.XSLT 1.0 处理器仅使用 XPath 1.0,并且 encode-for-uri() 函数未实现和可用.

The function encode-for-uri() is a standard function only in XPath 2.0 / XQuery . XSLT 1.0 processors only use XPath 1.0 and the encode-for-uri() function is not implemented and availavle.

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

In order to use this function you need an XSLT 2.0 processor, such as Saxon.NET or XQSharp.

这篇关于函数“fn:encode-for-uri"导致 XSLT 出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆