Skip to content

Instantly share code, notes, and snippets.

@jessgusclark
Created March 1, 2019 10:26
Show Gist options
  • Save jessgusclark/7f124a59a42055e2d714496fcd151d28 to your computer and use it in GitHub Desktop.
Save jessgusclark/7f124a59a42055e2d714496fcd151d28 to your computer and use it in GitHub Desktop.
<xsl:template match="component[@class='widgetAnywhere']">
<xsl:variable name="path" select="concat($ou:root, $ou:site, path)" />
<xsl:choose>
<!-- Show an error if the file can not be found on staging -->
<xsl:when test="not(doc-available(replace($path, '.htm', '.pcf')))">
<div class="panel">
<h2 class="normal-size">Widget Anywhere ERROR</h2>
<p>The include file could not be found on staging.</p>
<code><xsl:value-of select="path" /></code>
</div>
</xsl:when>
<!-- On Publish call the SSI template -->
<xsl:when test="$ou:action = 'pub'">
<xsl:copy-of select="ou:ssiAbsolute(path)" />
</xsl:when>
<!-- On preview, display the content -->
<xsl:when test="$ou:action = 'prv'">
<xsl:copy-of select="doc(replace($path, '.htm', '.pcf'))" />
</xsl:when>
<!-- On edit and compare show this panel -->
<xsl:otherwise>
<div class="panel">
<h2 class="normal-size">Widget Anywhere</h2>
<p>When this page is published out, the widget below will be included.</p>
<code><xsl:value-of select="path" /></code>
</div>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment