I have an XML that contains a special character (&
). The outputted value is obtained from a database and needs to remain as it is.
Below is an example of the XML
<Data>
<fname>Patrick</fname>
<lname>Lewis</lname>
<resortloc>the pearl & shine</resortloc>
</Data>
The issue here is the &
. Which is throwing an error -
An error occurred while parsing EntityName.
I also have a C# function that I created, to replace the &
character with a valid character see below. But when I run the code I still get the error. Could someone please help with this. Thank you
public static string EscapeXMLValue(string b)
{
return b.Replace( "&","&");
}
Below is my XSLT code
<xsl:value-of select= "cs:EscapeXMLValue(resortloc)" />
Please help. thank you.