I have a xml something likethis
<root>
<testxml>
<details name="test" url="http://www.test.com/test.aspx?val=100&val2=200" />
</testxml>
<root>
When i transform this xml using xslt to another xml
<xsl:output method="html" indent="yes" encoding="UTF-8" />
<xsl:template match="root/testxml/details">
<convert>
<xsl:attribute name="url">
<xsl:value-of select="@url"/>
</xsl:attribute>
</convert>
I get the result output as this
<convert url="http://www.test.com/test.aspx?val=100&val2=200">
instead of
<convert url="http://www.test.com/test.aspx?val=100&val2=200">
issue here is: & in url is getting changed to & amp; how can i avoid this ,i want & in url as &.(not & amp;)
i tried <xsl:value-of disable-output-escaping="yes" select="@url" />
also but of not use.
could anyone please help me in this..
There is no issue and the URL is not changed at all:
To verify this use a transformation like this:
when this transformation is applied on the following XML document:
The result is:
So, the URL hasn’t been changed in any way and there is still only a single
&character in it.What you observe is the mandatory escaping of some special characters (typically
<and&) in XML, as dictated by the XML Spec.The escaping of some special characters never alters the content of the string that is escaped — only how it looks like when it is a part of an XML document.
You cannot, and as shown above, there is nothing to avoid.