I have xml saved in database that looks like this
<Root><aaa>& < > </aaa></Root>.
I'm trying to transform this into another xml which should looks like this.
<Root><Value><![CDATA[<aaa>& < > </aaa>]]></Value></Root>
Doing the transform in two different places and getting two different results. My xslt does uses <xsl:copy-of> to copy the aaa node.
In altova XmlSpy and it gives me what I want. But in C#, ASP.NET 1.0 I'm getting the following. When I work with whats in the cdata, it is bad xml now.
<Root><Value><![CDATA[<aaa>& < > </aaa>]]></Value></Root>
Xslt Code is something like this:
Code:
<xsl:element name="Root">
<xsl:element name="Value">
<xsl:value-of select="$StartCDATA" disable-output-escaping="yes"/>
<xsl:copy-of select="aaa"></xsl:copy-of>
<xsl:value-of select="$EndCDATA" disable-output-escaping="yes"/>
</xsl:element>
</xsl:element>
C# code:
Code:
MemoryStream ms = new MemoryStream();
//Load the xslt and do the transform
XmlUrlResolver resolver = new XmlUrlResolver();
XslDoc.Load(XslMasterDoc, resolver, Assembly.GetExecutingAssembly().Evidence);
XslDoc.Transform(XmlSourceData, null, ms, resolver);
StreamReader sr = new StreamReader(ms);
ms.Seek(0, SeekOrigin.Begin);
string returnValue = sr.ReadToEnd();
Help would be greatly appreciated.