Tried urlencode(), but it returns double escaping error. Note that this question is not about to simply encode the whole url, but to escape some Special Characters for passing parameters. I had another situation, in which a parameter value has '+' sign in the string. I figured that it's probably better to show the string but return a nameid something as the value, which is int. My option value changed to something like this:
<select onchange="if(this.selectedIndex != 0) window.location = this.options[this.selectedIndex].value">
<option value="" selected="selected"><xsl:value-of select="/A/D/NAME"/></option>
<xsl:for-each select="/A/B/C">
<option value="URL&Name={NAME}&ID={ID}"
<xsl:if test="NAME=/A/D/NAME"><xsl:attribute name="selected">true</xsl:attribute></xsl:if>
<xsl:value-of select="NAME"/>
</option>
</xsl:for-each>
</select>
The url now have the Id as the parameter2 matching the parameter1(Name). And I can use this Id to search the database and return the string(Name) to show again. This doesn't directly answer the question, but does provide a workaround.