I've tried to find out the smartest way to url-encode a string in Xslt (through .NET). To my surprise I must say that the easiest and fastest way to solve the problem was not through clean xslt, but rather through the use of jscript.
<msxsl:script language="JScript" implements-prefix="xmlnamespaceofchoice">
<![CDATA[
function urlEncode(strURL)
{
return encodeURIComponent(strURL);
}
]]>
</msxsl:script>
and then calling the
<xsl:value-of select="xmlnamespaceofchoice:urlEncode(string(//myElement))" />
voila
No comments:
Post a Comment