|
next
|
 Subject: Calling the transformation from C#, disable-output-escaping="yes" is not functioning Author: Anil Kumar N Date: 01 Jul 2005 05:53 AM
|
Hi,
I have written an XSL transformation which transforms data from an XML file to HTML format.
The XML File contains data with embeded HTML tags,
for example "Description" field contains following value
<Description><LI>Individual e-mail accounts for all employees
<LI>Up to 50MB {correct?} of storage per account
<LI>Automatic Spam and Virus filtering </LI></Description>
I have used disable-output-escaping="yes" to display the description
<xsl:value-of disable-output-escaping="yes" select="/ContentData/ServiceDef/Description"/>
So, when I run the transformation from stylus studio, it converts the HTML tags. (i.e HTML Tags are converted appropriately).
I need to call this transformation from a C# application and I have written the following code
XslTransform xslt = new XslTransform();
xslt.Load(txtXSLTFile.Text);
XPathDocument xpathdocument = new XPathDocument(txtXMLFile.Text);
XmlTextWriter writer = new XmlTextWriter
(test.html",System.Text.Encoding.UTF8);
writer.Formatting=Formatting.Indented;
xslt.Transform(xpathdocument, null, writer, null);
xslt=null;
The issue is, When I call the transformation through C# application, disable-output-escaping="yes" doesn't have any effect. I mean to say
it deisplays
<LI>Individual e-mail accounts for all employees <LI>Up to 50MB {correct?} of storage per account <LI>Automatic Spam and Virus filtering </LI>
Where as I'm expecting (the List)
*Individual e-mail accounts for all employees
*Up to 50MB {correct?} of storage per account
*Automatic Spam and Virus filtering
This happens only when I try to transform through my C# application.
Plese let me know, what should be done in order to achive this
Thanks in advance,
Anil
|
top
|
 Subject: Calling the transformation from C#, disable-output-escaping= Author: prasad rama Date: 05 Feb 2009 07:02 PM
|
Hi Anil,
I am stuck with similar issue. Can u please tell me how you used HtmlTextWriter. Currently I am using XmlTextWriter, I am facing the same issue what u faced.
Dim strHtml As String
Dim ds As DataSet = GetData()
Dim strXstFile As String = Server.MapPath("ex_AZ_All_Products.xsl")
Dim x As New XslCompiledTransform()
' Load the XML
Dim doc As New XPathDocument(Server.MapPath("ex_AZ_All_Products.xml"))
' Load the style sheet.
Dim args As New XsltArgumentList()
Dim xslt As New XslCompiledTransform()
Dim stateCode As String = "ID"
Dim channelCode As String = "BR"
Dim prdCode As String = "All"
Dim lienCode As String = "1"
xslt.Load(strXstFile)
Dim ms As New MemoryStream()
Dim writer As New XmlTextWriter(ms, Encoding.Unicode)
Dim rd As New StreamReader(ms)
args.AddParam("StateName", "", stateCode)
args.AddParam("ProductName", "", prdCode)
args.AddParam("Lien", "", lienCode)
xslt.Transform(doc, args, writer)
ms.Position = 0
strHtml = rd.ReadToEnd()
rd.Close()
ms.Close()
Return strHtml
I am saving the strHtml into another file.
|
|
|
|