Tutorial :Converting from a Html encoded string to a 'normal' Url



Question:

I have a url in an xml documnent which is encoded

<Link>http://www.sample.com/test.asp?goto=HOTWIZ%26eapid=857</Link>  

I would like to convert that into a Url in the outputed Html.

I can output a link ok but i need the %26 to be converted to an &

I assume i could use some sort of replace functionality in XSLT but I imagine there is a more elegant solution

Cheers

To clarify the intent, is should be two seperate parameters, the url is stored in an xml document so needs the url needs to be encoded


Solution:1

There is a semantic difference between …?foo=bar&baz and …?foo=bar%26baz. The first is two arguments (foo with the value bar and bar with an empty value) while the second is just one argument (foo with the value bar&baz).


Solution:2

The & has been urlencoded (%26) rather than entity encoded - for a more "pure" xml approach you would entity encode it as &amp;

<Link>http://www.sample.com/test.asp?goto=HOTWIZ&amp;eapid=857</Link>  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »