我有一个 URI 编码的 XML 字符串,但无法使用 xslt 对其进行解码。
有一个fn:encode-for-uri对字符串进行编码
但没有 URI 解码 解码。
最佳答案
Michael Kay 回答了这个问题 here :
No there's no such function.
As a matter of interest, what's the use case?
I think the only reasons it's not there are (a) absence of a use case, and (b) difficulty in the detail of specifying it: what do you do for example with percent signs that aren't followed by two hex digits.
(b) 似乎很容易解决:要么说行为取决于实现,要么说处理器会抛出运行时错误。但也许这个问题比我所知道的更多。
更新:This follow-up post (在上面链接的同一个线程中)显示了一个函数的 XSLT 实现来解码百分比编码(非保留)字符。
关于xslt - 在 XSLT 2.0 中,为什么没有 fn :decode-for-uri?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16466799/