Subject:.NET XslCompileTransform strips newline character in xslt method="text" mode Author:Yitzhak Khabinsky Date:02 Jun 2016 05:00 PM
My Stylus Studio is X15 Release 2 Enterprise Edition, build 1928m.
I am trying to transform an XML file into *.csv text file via XSLT transformation.
In a SS scenario I use the .NET XslCompileTransform processor.
Unfortunately, the output doesn't respect newline character: 
.
input XML file:
<root>
<line>line1</line>
<line>line2</line>
<line>line3</line>
</root>
using (XmlReader src = XmlReader.Create(SOURCEXMLFILE))
{
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load(XSLTFILE, new XsltSettings(true,true), new XmlUrlResolver());
XmlWriter result = XmlWriter.Create(OUTPUTXMLFILE, settings);
xslt.Transform(src, new XsltArgumentList(), result, new XmlUrlResolver());
result.Close();
}
Subject:.NET XslCompileTransform strips newline character in xslt method= Author:Yitzhak Khabinsky Date:02 Jun 2016 08:27 PM
Hi Ivan
- We use SS as a development environment to create and test XSLTs.
- We use MS SQL Server SSIS XML Task XSLT operation as a production run-time environment. The SSIS XML Task is using .Net XslCompiledTransform API internally.
I hope you would fix SS .Net XslCompiledTransform implementation to resolve the issue we bumped into.
Subject:.NET XslCompileTransform strips newline character in xslt method= Author:Ivan Pedruzzi Date:03 Jun 2016 04:34 PM
We have determined that Stylus Studio runs the correct code when invoking XslCompiledTransform, this seems to be a defect in the .NET XmlWriter which merges multiple text node incorrectly.
Changing the XSLT code like the following solves the problem