Home

XSLTransform 0.1 Beta for ExpressionEngine 2

Merge entry- or template-based XML with XSL templates.

About XSLTransform

We’ve done quite a bit of work with XML stored in ExpressionEngine entries and XSL stored in server files, using in-template PHP to merge the two together. What’s the natural progression? Tag-based transforms with XSL stored in EE templates.

Download for ExpressionEngine 2 Download for ExpressionEngine 1.6.9

XSLTransform Usage

To install (EE2):

  1. Unzip the downloaded file
  2. Drill down into the system > expressionengine > third_party directory
  3. Copy the xsltransform directory into your site’s system > expressionengine > third_party directory.
  4. Head to Add-Ons > Plugins in your ExpressionEngine 2 Control Panel
  5. Click into XSLTransform in the list for details

To install (EE 1.6.9):

  1. Unzip the downloaded file
  2. Drill down into the system > plugins directory
  3. Copy the pi.xsltransform.php file into your site’s system > plugins directory.
  4. Head to Admin > Utilities > Plugins in your ExpressionEngine 1.6.9 Control Panel
  5. Click into XSLTransform in the list for details

Usage is simple. My XSL is in template index in template group xslt.

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="html" indent="yes" encoding="utf-8" omit-xml-declaration="yes"/>

  <xsl:template match="/">
    Hello <xsl:value-of select="."/>
  </xsl:template>
</xsl:stylesheet>

In my site’s template, I use the xsltransform tag to pull XML from an entry together with that template.

{exp:weblog:entries weblog="xml" url_title="xml1"}
{exp:xsltransform xsl='xslt/index'}{xml}{/exp:xsltransform}
{/exp:weblog:entries}

You can also use inline XML.

{exp:xsltransform xsl='xslt/index'}<xml><name type="first">Mark</name></xml>{/exp:xsltransform}

If all goes well, either should display:

Hello Mark

on your screen.

PHP4 & 5 are supported, but you'll need to figure out if you have the requisite libraries installed.

Feedback

Feedback is not only welcome, it’s appreciated! Email feedback AT markjreeves DOT com.

What’s Next

Feel free to use XSLTransform 0.1 Beta on sites that you manage, as you wish. It’s not supported and not for redistribution.

© 2010 Mark J. Reeves