Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I urlencode in XSLT?

Tags:

urlencode

xslt

How do I urlencode a url parameter in XSLT?

In php there is a function rawurlencode that does what I want, urlencode according to RFC 3986.

like image 991
tomsv Avatar asked Feb 25 '13 18:02

tomsv


People also ask

What is the use of UrlEncode?

The UrlEncode(String) method can be used to encode the entire URL, including query-string values. If characters such as blanks and punctuation are passed in an HTTP stream without encoding, they might be misinterpreted at the receiving end.

Do I need to UrlEncode post data?

General Answer. The general answer to your question is that it depends. And you get to decide by specifying what your "Content-Type" is in the HTTP headers. A value of "application/x-www-form-urlencoded" means that your POST body will need to be URL encoded just like a GET parameter string.


1 Answers

XPath 2.0 (and hence XSLT 2.0) has the encode-for-uri function. I'm not aware of any way to do it in plain XPath 1.0/XSLT 1.0 without using extension functions.

like image 200
Ian Roberts Avatar answered Sep 20 '22 05:09

Ian Roberts