xslt console whitespace newline

E

Electric Co.

Hello,

I am trying to write a small xslt utility to build and quickly check my
transforms. Unfortunately, I can not figure out how have the output
from the transform written to the console with indent and newline
formatting intact.

ie. Console Code:

XPathDocument myXPathDocument = new XPathDocument
("../../XMLFile1.xml", XmlSpace.Preserve);
XslTransform myXslTransform = new XslTransform();
XmlTextWriter writer = new XmlTextWriter("transform.xml", null);
myXslTransform.Load("../../XSLTFile1.xslt");
myXslTransform.Transform(myXPathDocument, null, writer, new
XmlUrlResolver());

writer.Close();

stream = new StreamReader ("transform.xml");
Console.Write(stream.ReadToEnd());

Transform:

:
:

</xsl:element>
<xsl:value-of select="'\n'"/>
</xsl:for-each>

This just write the string literal "/n".

Any help would be appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,222
Members
46,810
Latest member
Kassie0918

Latest Threads

Top