Skip to content

Instantly share code, notes, and snippets.

@ctbarber
Created March 27, 2017 19:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ctbarber/303546dc2c910161bef7db1b9cb7d769 to your computer and use it in GitHub Desktop.
Save ctbarber/303546dc2c910161bef7db1b9cb7d769 to your computer and use it in GitHub Desktop.
<!-- begin template match for news boxes snippet -->
<xsl:template match="table[@class='snippet-news-boxes']" mode="copy">
<xsl:variable name="news-theme-color">
<xsl:choose>
<xsl:when test="lower-case(tbody/tr[4]/td[2]/node()) = 'white'">
<xsl:text></xsl:text>
</xsl:when>
<xsl:when test="lower-case(tbody/tr[4]/td[2]/node()) = 'green'">
<xsl:text> uthsc-news-box-dark</xsl:text>
</xsl:when>
<xsl:otherwise>
<!-- this sets class name and by default it is blue so no class needed -->
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="news-id" select="generate-id()" />
<xsl:choose>
<xsl:when test="$ou:action = 'pub'">
<div class="news-snippet-{$news-id} row medium-up-2 large-up-3 {$news-theme-color}" data-equalizer="news-boxes-{$news-id}" data-equalize-on="large"></div>
<xsl:value-of select="concat('&lt;?php $uthsc_news[&quot;',$news-id,'&quot;] = array(&quot;post_count&quot; =&gt; &quot;',replace(tbody/tr[3]/td[2]/node(),' ',''),'&quot;, &quot;categories&quot; =&gt; &quot;',tbody/tr[2]/td[2]/node(),'&quot;); ?&gt;')" disable-output-escaping="yes"/>
</xsl:when>
<xsl:otherwise>
<div class="callout secondary"><p><span class="fa fa-info-circle fa-2x" style="vertical-align: -20%;margin-right: 0.3em;color:#002664;" aria-hidden="true"></span> The News will only show up once the page has been published.</p></div>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- end template match for news boxes snippet -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment