Hi, im trying to create a text email message using xslt template , the
transforms work great, but the newlines and whitespace in the xslt doc
are removed. Is there a setting somewhere I have missed:
My template is:
<?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">
<xsl:output indent="yes" method="text" media-type="text/xml"
encoding="UTF-8" omit-xml-declaration="yes" />
<xsl:template match="MailTemplate">
<xsl:value-of select="MailTitle"/>
<xsl:text disable-output-escaping="yes">
</xsl:text>
Dear <xsl:value-of select="RecipientName"/>,
<xsl:for-each select="BodylinesCollection/Line">
<xsl:text disable-output-escaping="yes"></xsl:text>
<xsl:text disable-output-escaping="yes"></xsl:text>
<xsl:value-of select="."/>
</xsl:for-each>
<xsl:text disable-output-escaping="yes"></xsl:text>
<xsl:value-of select="LinkUrl"/>
</xsl:template>
</xsl:stylesheet>
My processing is:
XmlSerializer xmlSerialization = new XmlSerializer(typeof
(MailTemplate));
xmlSerialization.Serialize(textWriter, mailTemplate);
memoryStream.Flush();
memoryStream.Seek(0, SeekOrigin.Begin);
XmlDocument input = new XmlDocument();
input.Load(memoryStream);
input.PreserveWhitespace = true;
XsltArgumentList args = new XsltArgumentList();
XslCompiledTransform xsl = new XslCompiledTransform();
xsl.Load(GetInvitationTemplate(false));
xsl.OutputSettings.NewLineOnAttributes = true;
xsl.Transform(input, args, resultStream);
resultStream.Flush();
resultStream.Seek(0, SeekOrigin.Begin);
plainText = reader.ReadToEnd();
I have tried playing with indent setting on xslt, no luck, I also
added:
input.PreserveWhitespace = true;
and
xsl.OutputSettings.NewLineOnAttributes = true;
none seem to have any effect.
thanks
Joel