Hello. I am encountering a strange issue for email content generated
from an XML file and processed through an XSL file.

Here's how it goes down. A newsletter is created in XML. It then gets
processed through an XSL file for reading either on the web or through
email. The problem is that when it is generated as an email message,
MS Outlook will display odd characters such as daggers or asian
characters.

To make matters even more confusing, it doesn't happen on every
Outlook install. It only happens on a few of them.

Other things:
The XSL transformation is being process through some C# code.
The XSL file specifies output encoding of "utf-8" but the HTML code
that is generated has a meta tag (added by the parser) that specifies
encoding as "utf-16"

The code I listed also has some other variables such as "@domain" or
"@name_company".  These are special variables that our email program
will replace when the message is sent. Please disregard them unless
they are the problem.

---------------------------------------------------------------------------------------
Here is the XSL file I am using:
---------------------------------------------------------------------------------------
<?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 doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-
transitional.dtd" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//
EN" encoding="utf-8" method="html" indent="yes" omit-xml-
declaration="yes" />
  <xsl:param name="baseurl" select="''" />
  <xsl:template match="/newsletter">
    <html>
      <head>
        <meta http-equiv="Content-Language" content="en-us" />
        <style type="text/css">
          /*Remove styles for legibility*/
        </style>
      </head>
      <body>
        <table width="565" cellpadding="0" cellspacing="0"
id="newsletter">
          <tr>
            <td colspan="2" id="newsletter-header">
              <img src="http://w...@domain/themes/classic/images/
newsletter/markettrendsheader.jpg" alt="header" title="Market Trends" /
>
            </td>
          </tr>
          <tr>
            <td id="newsletter-title">
              <p>
                <strong>
                  <xsl:value-of select="title"/>
                </strong>
              </p>
            </td>
            <td width="160" valign="top" id="newsletter-side"
rowspan="2">
              <xsl:if test="listing">
                <div id="newsletter-featuredlisting">
                  <p class="title">Featured Listing</p>
                  <a title="Featured Property" rel="nofollow">
                    <xsl:attribute name="href">
                      <xsl:value-of select="listing/link"/>
                    </xsl:attribute>
                    <img alt="Featured Listing" title="Featured
Listing">
                      <xsl:attribute name="src">
                        <xsl:value-of select="listing/pictures/picture
[...@index='0']/url"/>?size=Newsletter
                      </xsl:attribute>
                    </img>
                  </a>
                  <p class="price">
                    For Sale: <xsl:value-of select="format-number
(listing/price, '$###,###')"/>
                  </p>
                  <a class="more-info" title="More Information"
rel="nofollow">
                    <xsl:attribute name="href">
                      <xsl:value-of select="listing/link"/>
                    </xsl:attribute>
                    More Information
                  </a>
                </div>
              </xsl:if>
              <div id="newsletter-links">
                <!-- I match each link individually so that I can
control the order of the links -->
                <xsl:if test="links/li...@type='properties']">
                  <xsl:apply-templates select="links/link
[...@type='properties']" />
                </xsl:if>
                <xsl:if test="links/li...@type='buyers']">
                  <xsl:apply-templates select="links/link
[...@type='buyers']" />
                </xsl:if>
                <xsl:if test="links/li...@type='sellers']">
                  <xsl:apply-templates select="links/link
[...@type='sellers']" />
                </xsl:if>
                <xsl:if test="links/li...@type='blog']">
                  <xsl:apply-templates select="links/link
[...@type='blog']" />
                </xsl:if>
                <xsl:if test="links/li...@type='podcast']">
                  <xsl:apply-templates select="links/link
[...@type='podcast']" />
                </xsl:if>
              </div>
            </td>
          </tr>
          <tr>
            <td width="430" valign="top">
              <div id="newsletter-body">
                <xsl:for-each select="article">
                  <div class="article">
                    <p class="article-heading">
                      <strong>
                        <xsl:value-of select="title"/>
                      </strong>
                    </p>
                    <p class="article-body">
                      <xsl:value-of select="body-truncated" disable-
output-escaping="yes"/>
                    </p>
                    <a class="continue" href="http://w...@domain/
Newsletter" title="Continue Reading">Continue Reading...</a>
                  </div>
                </xsl:for-each>
              </div>
            </td>
          </tr>
          <tr>
            <td id="newsletter-footer" colspan="2">
              <img alt="footer" src="http://w...@domain/stationery/
newsletter/bottom.jpg" />
              <div id="contact" align="center">
                <xsl:value-of select="agent/name" />,
@name_company<br />
                @contact_address, @contact_city @contact_state
@contact_zip<br />
                @contact_phone_1<br /><br />
                <img src="http://w...@domain/stationery/mail/logo.gif";
alt="logo" /><br />
                <a href="http://w...@domain"; title="Visit 
http://w...@domain";>Visit
http://w...@domain</a><br /><br />
                @optout
              </div>
            </td>
          </tr>
        </table>
      </body>
    </html>
  </xsl:template>

  <xsl:template match="link">
    <a rel="nofollow">
      <xsl:attribute name="class">
        <xsl:value-of select="@type"/>
      </xsl:attribute>
      <xsl:attribute name="href">
        <xsl:value-of select="@url" />
      </xsl:attribute>
      <xsl:choose>
        <xsl:when test="@type='properties'">
          <img alt="Homes For Sale" title="Homes For Sale" src="http://
w...@domain/themes/classic/images/newsletter/btn_homesforsale.jpg" />
        </xsl:when>
        <xsl:when test="@type='buyers'">
          <img alt="Email Home Search" title="Email Home Search"
src="http://w...@domain/themes/classic/images/newsletter/
btn_email.jpg" />
        </xsl:when>
        <xsl:when test="@type='sellers'">
          <img alt="What's Your Home Worth?" title="What's Your Home
Worth?" src="http://w...@domain/themes/classic/images/newsletter/
btn_homeworth.jpg" />
        </xsl:when>
        <xsl:when test="@type='addonfsbo'">
          <img alt="For Sale By Owner" title="For Sale By Owner"
src="http://w...@domain/themes/classic/images/newsletter/
btn_fsbo.jpg" />
        </xsl:when>
        <xsl:when test="@type='blog'">
          <img alt="Blog" title="Blog" src="http://w...@domain/themes/
classic/images/newsletter/btn_blog.jpg" />
        </xsl:when>
        <xsl:when test="@type='podcast'">
          <img alt="Podcast" title="Podcast" src="http://w...@domain/
themes/classic/images/newsletter/btn_podcast.jpg" />
          Podcast
        </xsl:when>
      </xsl:choose>
    </a>
    <br />
  </xsl:template>
</xsl:stylesheet>

Reply via email to