PC Review


Reply
Thread Tools Rate Thread

How do I get HTML output from XslCompiledTransform in 2.0?

 
 
=?Utf-8?B?bHdpY2tsYW5k?=
Guest
Posts: n/a
 
      28th Oct 2005
How do I get HTML output from the new in 2.0 XslCompiledTransform?

The XslCompiledTransform class has a read only OutputMethod property. The
XslCompiledTransform.Transform() method takes an XmlWriter, which has an
XmlSettings object with a read only OutputMethod property. At runtime
XslCompiledTransform doesn't appear to honor an <xslutput method="html"/>
tag in the supplied XSL.

Do you have any suggestions?

Thank you.


 
Reply With Quote
 
 
 
 
Daniel O'Connell [C# MVP]
Guest
Posts: n/a
 
      29th Oct 2005

"lwickland" <(E-Mail Removed)> wrote in message
news:7FB1CFC1-36B3-4F3F-A3EB-(E-Mail Removed)...
> How do I get HTML output from the new in 2.0 XslCompiledTransform?
>
> The XslCompiledTransform class has a read only OutputMethod property. The
> XslCompiledTransform.Transform() method takes an XmlWriter, which has an
> XmlSettings object with a read only OutputMethod property. At runtime
> XslCompiledTransform doesn't appear to honor an <xslutput
> method="html"/>
> tag in the supplied XSL.
>
> Do you have any suggestions?
>


Well, the simplist option is to generate xhtml. However, the Transfomr
method appears to take TextWriter and Stream as well. Maybe you need to use
a different overload?


 
Reply With Quote
 
=?Utf-8?B?bHdpY2tsYW5k?=
Guest
Posts: n/a
 
      31st Oct 2005
Daniel,

Thanks for the suggestion. Using a Stream instead of an XmlWriter for the
last argument solvled the problem.

Leif

"Daniel O'Connell [C# MVP]" wrote:

>
> "lwickland" <(E-Mail Removed)> wrote in message
> news:7FB1CFC1-36B3-4F3F-A3EB-(E-Mail Removed)...
> > How do I get HTML output from the new in 2.0 XslCompiledTransform?
> >
> > The XslCompiledTransform class has a read only OutputMethod property. The
> > XslCompiledTransform.Transform() method takes an XmlWriter, which has an
> > XmlSettings object with a read only OutputMethod property. At runtime
> > XslCompiledTransform doesn't appear to honor an <xslutput
> > method="html"/>
> > tag in the supplied XSL.
> >
> > Do you have any suggestions?
> >

>
> Well, the simplist option is to generate xhtml. However, the Transfomr
> method appears to take TextWriter and Stream as well. Maybe you need to use
> a different overload?
>
>
>

 
Reply With Quote
 
=?Utf-8?B?QW50b24gTGFwb3Vub3Y=?=
Guest
Posts: n/a
 
      22nd May 2006
Sorry for the late answer. Let me cite the "Introducing XslCompiledTransform"
article:

Respecting xslutput: OutputSettings property

If a client application uses a Transform overload that takes an XmlWriter as
the output object, XslCompiledTransform ignores all xslutput settings
specified in the stylesheet. In this case the client is responsible for
output serialization. It may control serialization process by either passing
a custom implementation of XmlWriter or adjusting the properties of the
standard XmlTextWriter. If the client needs to know serialization settings
specified in the stylesheet, it may obtain them through the
XslCompiledTransform.OutputSettings property. Suppose, for example, that the
client needs to turn character checking off, but respect other xslutput
settings. It may use the following code to achieve that:

// Load the stylesheet
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load("MyStylesheet.xsl");

// Clone its output settings and turn character checking off
XmlWriterSettings ws = xslt.OutputSettings.Clone();
ws.CheckCharacters = false;

// Run the transformation with changed output settings
xslt.Transform("MyDocument.xml", XmlWriter.Create(Console.Out, ws));
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
C# Source output to HTML t f Microsoft C# .NET 0 20th Nov 2007 05:46 PM
Output to (html) =?Utf-8?B?S2F0?= Microsoft Access Reports 0 14th Feb 2007 04:02 PM
Copy HTML output to VB.net Daniel N Microsoft Dot NET 1 23rd Aug 2006 06:35 PM
XslCompiledTransform into a 'String' rather than Response.Output/Stream daz_oldham Microsoft C# .NET 2 4th Jun 2006 02:48 PM
Output to Html... =?Utf-8?B?RGlhbmVG?= Microsoft Access Reports 0 20th Jan 2006 05:43 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:20 PM.