Solenopsis with XSLT

by Patrick Connelly posted on July 22, 2016

There’s a great feature we use all the time in Solenopsis that isn’t as documented as it should be. This is the ability to write an XSLT to apply to your objects at time of pull, push or both.

Use Case

If you have a workflow that sends an email, you’ve seen that part of the workflow file is the senderAddress element. The element determines who the email goes to. This becomes a problem when you have a sender that differs in a sandbox than it does in production. Fortunately Solenopsis has supported variable expansion for a while so you can have the following in your workflow XML and in your properties file and the variable will be filled in when you push

senderAddress =

However whenever you pull down the workflow file the variable expansion will not be there and instead you’ll have your address

Solenopsis with XSLT

This is where the Solenopsis XSLTs come into play. By creating a folder structure that mimics our source directory we can apply XSLTs to our workflow file

 |--- src
 |     |
 |     \--- workflows
 |            |
 |            \--- Case.workflow
 \--- xslt
       \--- workflows
              \--- Case_pull.xsl

The naming structure for the xsl files is

  • Filename.xsl – This will be applied to both pull and push
  • Filename_pull.xsl – This will only be applied to a pull
  • Filename_push.xsl – This will only be applied to a push

Since we want the push to use the variable expansion we only want to apply our XSLT on pull actions. So we’ll fill out the Case_pull.xsl have the following content

<?xml version="1.0"?>
<xsl:transform version="1.0" xmlns:xsl="" xmlns:sfdc="">
    <xsl:output method="xml" version="1.0" indent="yes"/>

    <xsl:template match="node()|@*">

            <xsl:apply-templates select="node()|@*"/>

    <xsl:template match="sfdc:alerts/sfdc:senderAddress/text()">@{senderAddress}</xsl:template>

And by adding the following to our file

sf.xslDir = /path/to/xslt/

And this will apply our XSLTs