Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In XSLT 2.0, why is there no fn:decode-for-uri?

I have a URI encoded string in XML but can't decode it using xslt.

There is a fn:encode-for-uri to encode the string

But no decode-for-uri to decode.

  1. Is there a function I have missed?
  2. If not, why does it not exist?
like image 603
Rob Avatar asked Oct 05 '22 04:10

Rob


1 Answers

Michael Kay answered this question 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) seems easy enough to solve: either say behavior is implementation dependent, or say the processor will throw a runtime error. But maybe there's more to this question than I'm aware of.

Update: This follow-up post (in the same thread as linked above) shows an XSLT implementation of a function to decode percent-encoded (unreserved) characters.

like image 116
LarsH Avatar answered Oct 13 '22 11:10

LarsH