I get output like this
instead
the problem is here: in the url it turns out changed to and
No problem, and the URL does not change at all :
To verify this, use the following conversion:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text"/> <xsl:strip-space elements="*"/> <xsl:template match="/*"> <xsl:value-of select="@url"/> </xsl:template> </xsl:stylesheet>
when this conversion is applied to the following XML document:
<convert url="http://www.test.com/test.aspx?val=100&val2=200"/>
Result :
http:
So, the URL has not been changed in any way, and there is only one & character left in it.
What you are observing is the mandatory escaping of some special characters (usually < and & ) in XML, as dictated by the XML specification.
Removing some special characters never changes the contents of a string that is escaped - just what it looks like when it is part of an XML document.
how can i avoid this i want in url like & (not & amp;)
You cannot, and as shown above, nothing can be avoided.
source share