Created
March 27, 2017 19:17
-
-
Save ctbarber/7d8cefcba5246b4692fc99080ca0e3cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 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('<a href="',tbody/tr[5]/td[2]/a[1]/@href,'">')" 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"></a></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