Reputation: 37698
I tried:
<PRE>
tag in the output around the comments and encoding of the NL character<BR>
tag in the data (does not get decoded in the HTML)Can this be done without rearchitecting everything?
Per request in the comments, here is the actual code:
<TD>
<xsl:value-of select="//MemoComment"/>
</TD>
<MemoComment>Previous job: Associate, Boston<br/>Test1<br/>Test2</MemoComment>
<MemoComment>Previous job: Associate, Boston &#xA;Test1 &#xA;Test2</MemoComment>
<MemoComment>Previous job: Associate, Boston&lt;br/&gt;Test1<br/>Test2</MemoComment>
<TD>Previous job: Associate, BostonTest1Test2</TD>
<TD>Previous job: Associate, Boston&#xA;Test1&#xA;Test2</TD>
<TD>Previous job: Associate, Boston&lt;br/&gt;Test1<br/>Test2</TD>
None of which renders correctly in Outlook.
Upvotes: 2
Views: 2177
Reputation: 13986
Reason for your problem was that you used <xsl:value-of>
<TD>
<xsl:value-of select="//MemoComment"/>
</TD>
when you actually needed <xsl:copy-of>
<TD>
<xsl:copy-of select="//MemoComment/node()"/>
</TD>
<xsl:value-of>
only selects the string value of the selected node. What you actually wanted is to copy of whole node including the elements that it contained. Then you can save the data as a formatted XHTML snippet without the need of element syntax escaping (format number 1 on your input list).
Usage of disabe-output-escaping="yes"
is often discouraged because it can lead to outputting malformed XML. Also all XSLT processors don't implement this feature since it actually takes effect only when the document is serialized, and might not have any effect if the output document is passed on from the processor as a data structure.
Upvotes: 3
Reputation: 263047
Try embedding escaped <br>
elements in your text and setting the disable-output-escaping
attribute of your <xsl:value-of>
element to yes
:
<MemoComment>Previous job: Associate, Boston<br/>Test1<br/>Test2</MemoComment>
<xsl:value-of select="//MemoComment" disable-output-escaping="yes" />
Upvotes: 1