Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: newLine issue when using XSLCompiledTransform.Transform() [Thread Next] Re: newLine issue when using XSLCompiledTransform.Transform()To: NULL Date: 5/14/2009 10:06:00 AM Hi Martin,
I assigned the generated text to the .text property of the RTF control and
it shows it in new lines.But when i set the "result" to the .Rtf property of
the RichText it does not..may be this is a RichTextBox control issue...
Thanks a lot for your help...
"Martin Honnen" wrote:
> Zest4Quest wrote:
> > <?xml version="1.0" encoding="utf-8"?>
> > <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> > xmlns:msxsl="urn:schemas-microsoft-com:xslt"
> > exclude-result-prefixes="msxsl"
> > xmlns:ms="urn:schemas-microsoft-com:xslt"
> > xmlns:dt="urn:schemas-microsoft-com:datatypes">
> >
> > <xsl:output method="text" indent="yes"/>
> >
> > <xsl:template match="/">
> > <xsl:text>{\rtf1{\fonttbl{\f0\fnil\fcharset0
> > Arial;}}\viewkind4\uc1\pard\lang1033\fs18</xsl:text>
> > <xsl:for-each select="Assessment/ObGyn">
> > <xsl:if test ="OBGYNNotes != ''">
> > <xsl:text> \line \b Additional Information: \b0 </xsl:text>
> > <xsl:value-of select ="OBGYNNotes"/>
> > </xsl:if>
> > </xsl:for-each>
> > <xsl:text>}</xsl:text>
> > </xsl:template>
> > </xsl:stylesheet>
>
> When I take that stylesheet and use it with Visual Studio 2008 in a .NET
> 3.5 application with the following code
>
> using System;
> using System.Collections.Generic;
> using System.IO;
> using System.Linq;
> using System.Text;
> using System.Xml;
> using System.Xml.Xsl;
> using System.Xml.XPath;
>
> namespace ConsoleApplication568
> {
> class Program
> {
> static void Main(string[] args)
> {
> string xml = @"<?xml version=""1.0""
> encoding=""utf-16""?><Assessment
> xmlns:i=""http://www.w3.org/2001/XMLSchema-instance"" >
> <ObGyn>
> <OBGYNNotes>a
> b
> c
> d
> e
> </OBGYNNotes>
> </ObGyn>
> </Assessment>";
>
> XslCompiledTransform proc = new XslCompiledTransform();
> proc.Load(@"..\..\XSLTFile2.xslt");
> string result;
> using (StringWriter sw = new StringWriter())
> {
> proc.Transform(new XPathDocument(new
> StringReader(xml)), null, sw);
> result = sw.ToString();
> sw.Close();
> }
> Console.WriteLine("Result is|{0}|", result);
>
> }
> }
> }
>
> it outputs
>
> Result is|{\rtf1{\fonttbl{\f0\fnil\fcharset0
> Arial;}}\viewkind4\uc1\pard\lang1033\fs18 \line \b Additional
> Information: \b0
> a
> b
> c
> d
> e
> }|
>
> to the console so I don't see any missing line breaks.
>
>
>
> --
>
> Martin Honnen --- MVP XML
> http://msmvps.com/blogs/martin_honnen/
>
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
