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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With