Search

A new XSLT utility, “HTML to Email Text” is now available for download. Comments and feedback can be left here but if you discover any issues, please post it on the issue tracker.

This utility has been developed to be used with the Email Newsletters extension. It is based on the HTML To Markdown Text utility.

Website authors may write content using Markdown or even HTML markup. This is why you should not use unformatted textarea datasource output to create email text content. Instead you may use XSLT to build the text content (based on your datasource’s formatted, i.e. HTML, output).

Usage

A very simple example page XSLT might look like this:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:import href="../utilities/html2emailtext.xsl"/>

<xsl:output method="xml"
    omit-xml-declaration="yes"
    encoding="utf-8"
    indent="yes" />

<xsl:template match="data">
    <xsl:apply-templates select="newsletter/entry[1]"/>
</xsl:template>

<xsl:template match="newsletter/entry">
    <xsl:value-of select="title"/>
    <xsl:text>&#xA;&#xA;</xsl:text>
    <xsl:apply-templates select="text" mode="email"/>
    <xsl:text>&#xA;</xsl:text>
    <xsl:text>--</xsl:text>
    <xsl:text>
This is the signature...
    </xsl:text>

</xsl:template>

</xsl:stylesheet>

This is a start. But be warned: Creating TEXT pages (and HTML pages alike) suitable for emails is a hassle!

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details