Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: newLine issue when using XSLCompiledTransform.Transform()

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 5/14/2009 1:47:00 PM
Zest4Quest wrote:
> Hi,
>   I have an xml in the following format
> <?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>
> 
> The characters in "abcde" all are in seperate lines which is picked up from 
> the UI.
> 
> Now when i transform this xml to an RTF format the "abcde" instead of 
> retaining the newline effect comes out as "abcde" as if its one word. The 
> code that i am using to do the conversion is given below. The sXML holds the 
> above xml.

How are you looking at the transformation result?
I can't reproduce the problem with a simple console application.
The XSLT is as follows:

<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"
 >
     <xsl:output method="text" indent="yes"/>

   <xsl:template match="/">
     <xsl:value-of select="concat('|', Assessment/ObGyn/OBGYNNotes, '|')"/>
   </xsl:template>
</xsl:stylesheet>

The console code simply does

             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(@"..\..\XSLTFile1.xslt");
             proc.Transform(new XPathDocument(new StringReader(xml)), 
null, Console.Out);

the output on the console is

|a
b
c
d
e
|


So I am not sure where the problem comes from.

-- 

	Martin Honnen --- MVP XML
	http://msmvps.com/blogs/martin_honnen/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent