Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<!-- begin template match to strip anchor tags from highlight box -->
<xsl:template match="table[@class='snippet-highlight-box']/tbody/tr/*/a" priority="3" mode="copy">
<xsl:apply-templates />
</xsl:template>
<!-- end template match to strip anchor tags from highlight box -->
<!-- begin template match for highlight box snippet -->
<xsl:template match="table[@class='snippet-highlight-box']" mode="copy">
<xsl:variable name="highlight-color">
<xsl:choose>
<xsl:when test="lower-case(tbody/tr[2]/td[2]/node()) = 'purple'">
<xsl:text> uthsc-highlight-box-purple</xsl:text>
</xsl:when>
<xsl:when test="lower-case(tbody/tr[2]/td[2]/node()) = 'green'">
<xsl:text> uthsc-highlight-box-green</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="highlight-box-border">
<xsl:choose>
<xsl:when test="lower-case(tbody/tr[3]/td[2]/node()) = 'yes'">
<xsl:text> uthsc-highlight-box-border</xsl:text>
</xsl:when>
<xsl:otherwise>
<!-- this sets class name and by default it is no border so no class needed -->
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<div class="uthsc-highlight-box{$highlight-color} {$highlight-box-border}">
<xsl:if test="tbody/tr[5]/td[2]/a[1]/@href">
<xsl:value-of select="concat('&lt;a href=&quot;',tbody/tr[5]/td[2]/a[1]/@href,'&quot;&gt;')" disable-output-escaping="yes" />
</xsl:if>
<div class="uthsc-highlight-box-image">
<xsl:apply-templates select="tbody/tr[4]/td[2]/img[1]" mode="copy"/>
</div>
<div class="uthsc-highlight-box-title">
<p>
<xsl:value-of select="tbody/tr[5]/td[2]/node()" />
</p>
</div>
<div class="uthsc-highlight-box-description">
<xsl:apply-templates select="tbody/tr[6]/td[2]/node()" mode="copy"/>
</div>
<xsl:if test="tbody/tr[5]/td[2]/a[1]/@href">
<xsl:text disable-output-escaping="yes">&lt;/a&gt;</xsl:text>
</xsl:if>
</div>
</xsl:template>
<!-- end template match for highlight box snippet -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment