Skip to content

Instantly share code, notes, and snippets.

@ctbarber
Created April 4, 2017 17:06
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/26c85e6c92e819ca089b05eebeee89bc to your computer and use it in GitHub Desktop.
Save ctbarber/26c85e6c92e819ca089b05eebeee89bc to your computer and use it in GitHub Desktop.
<!-- template match for block grid snippet -->
<xsl:template match="table[@class='snippet-block-grid']" mode="copy">
<xsl:variable name="medium-grid">
<xsl:choose>
<xsl:when test="lower-case(tbody/tr[2]/td[2]/node()) = '3'">
<xsl:text>medium-up-3</xsl:text>
</xsl:when>
<xsl:when test="lower-case(tbody/tr[2]/td[2]/node()) = '4'">
<xsl:text>medium-up-4</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>medium-up-2</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="large-grid">
<xsl:choose>
<xsl:when test="lower-case(tbody/tr[3]/td[2]/node()) = '3'">
<xsl:text>large-up-3</xsl:text>
</xsl:when>
<xsl:when test="lower-case(tbody/tr[3]/td[2]/node()) = '5'">
<xsl:text>large-up-5</xsl:text>
</xsl:when>
<xsl:when test="lower-case(tbody/tr[3]/td[2]/node()) = '6'">
<xsl:text>large-up-6</xsl:text>
</xsl:when>
<xsl:when test="lower-case(tbody/tr[3]/td[2]/node()) = '7'">
<xsl:text>large-up-7</xsl:text>
</xsl:when>
<xsl:when test="lower-case(tbody/tr[3]/td[2]/node()) = '8'">
<xsl:text>large-up-8</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>large-up-4</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<div class="row uthsc-block-grid {$medium-grid} {$large-grid}">
<xsl:for-each select="tbody/tr/td">
<xsl:if test="position() > 5">
<xsl:if test="*">
<div class="column">
<xsl:apply-templates select="node()" mode="copy"/>
</div>
</xsl:if>
</xsl:if>
</xsl:for-each>
</div>
</xsl:template>
<!-- end template match for block grid snippet -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment