viv:url-add-params

appends one or more name/value pairs to a URL, using proper separators

Synopsis

string
	viv:url-add-params
	(url, name, value, [...]);
string    url;
string    name;
string    value;
[...]    [...];

Description

Append name/value pairs of CGI parameters to a URL, adding '?' and the '&' separator when necessary, and escaping the parameters properly. Note that any number of name/value pair can be added, the number of arguments just needs to be odd.

Arguments

  • url: the parameters to which the CGI parameters will be added.
  • name: the name of a CGI parameter
  • value: the value of a CGI parameter

Returns

the URL with the parameters appended

Example

    <xsl:value-of select="viv:url-add-params(
    'http://z.com/ok?a=b',
    'c', 'd',
    'e', '',
    'f', 'g h')" />

Calling the previous function will return the following:

    http://z.com/ok?a=b&c=d&e=&f=g_h