XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Anil Kumar NSubject: 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>&lt;LI&gt;Individual e-mail accounts for all employees
&lt;LI&gt;Up to 50MB {correct?} of storage per account
&lt;LI&gt;Automatic Spam and Virus filtering &lt;/LI&gt;</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

Postnext
Ivan PedruzziSubject: Calling the transformation from C#, disable-output-escaping=
Author: Ivan Pedruzzi
Date: 01 Jul 2005 12:28 PM
Hi Anil,

As stated in the .NET documentation XMLTextWriter doesn't escape entities. You can either use Stream or HtmlTextWriter.

Hope this helps
Ivan Pedruzzi
Stylus Studio Team







Postnext
Anil Kumar NSubject: Calling the transformation from C#, disable-output-escaping=
Author: Anil Kumar N
Date: 04 Jul 2005 04:49 AM
Dear Mr.Ivan Pedruzzi
Thanks for the support, That did worked.


Thanking Again,
Anil Kumar N

Posttop
prasad ramaSubject: 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.

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.