Created
March 27, 2017 18:55
-
-
Save ctbarber/0efbb00a65eab81306975d2fc271ebe7 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 for FAQ snippet --> | |
<xsl:template match="table[@class='snippet-faq']" mode="copy"> | |
<div class="uthsc-faq"> | |
<xsl:for-each select="tbody/tr"> | |
<xsl:if test="position() > 3"> | |
<xsl:variable name="anchor-link"> | |
<xsl:choose> | |
<xsl:when test="string-length(normalize-space(td[3])) > 1"> | |
<xsl:value-of select="lower-case(replace(replace(td[3], '[^a-zA-Z0-9 ]', ''),' ', '-'))" /> | |
</xsl:when> | |
<xsl:otherwise> | |
<xsl:value-of select="generate-id()" /> | |
</xsl:otherwise> | |
</xsl:choose> | |
</xsl:variable> | |
<xsl:choose> | |
<xsl:when test="starts-with(td[1],'heading')"> | |
<xsl:choose> | |
<xsl:when test="ends-with(td[1],'1')"> | |
<h2 class="uthsc-faq-heading-1"><a href="#{$anchor-link}"><xsl:value-of select="td[2]/node()" /></a></h2> | |
</xsl:when> | |
<xsl:when test="ends-with(td[1],'2')"> | |
<h3 class="uthsc-faq-heading-2"><a href="#{$anchor-link}"><xsl:value-of select="td[2]/node()" /></a></h3> | |
</xsl:when> | |
</xsl:choose> | |
</xsl:when> | |
<xsl:otherwise> | |
<p class="uthsc-faq-question"><a href="#{$anchor-link}"><xsl:value-of select="td[1]/node()" /></a></p> | |
</xsl:otherwise> | |
</xsl:choose> | |
</xsl:if> | |
</xsl:for-each> | |
<div class="columns uthsc-row-title"> | |
<h2>Answers</h2> | |
</div> | |
<br style="clear:both;" /> | |
<xsl:for-each select="tbody/tr"> | |
<xsl:variable name="anchor-link"> | |
<xsl:choose> | |
<xsl:when test="string-length(normalize-space(td[3])) > 1"> | |
<xsl:value-of select="lower-case(replace(replace(td[3], '[^a-zA-Z0-9 ]', ''),' ', '-'))" /> | |
</xsl:when> | |
<xsl:otherwise> | |
<xsl:value-of select="generate-id()" /> | |
</xsl:otherwise> | |
</xsl:choose> | |
</xsl:variable> | |
<xsl:if test="position() > 3"> | |
<xsl:choose> | |
<xsl:when test="starts-with(td[1],'heading')"> | |
<xsl:choose> | |
<xsl:when test="ends-with(td[1],'1')"> | |
<h2 class="uthsc-faq-heading-1" id="{$anchor-link}"><xsl:value-of select="td[2]/node()" /></h2> | |
</xsl:when> | |
<xsl:when test="ends-with(td[1],'2')"> | |
<h3 class="uthsc-faq-heading-2" id="{$anchor-link}"><xsl:value-of select="td[2]/node()" /></h3> | |
</xsl:when> | |
</xsl:choose> | |
</xsl:when> | |
<xsl:otherwise> | |
<div class="uthsc-faq-answer"> | |
<h4 class="uthsc-faq-answer-heading" id="{$anchor-link}"><xsl:value-of select="td[1]/node()" /></h4> | |
<xsl:apply-templates select="td[2]/node()" mode="copy"/> | |
</div> | |
</xsl:otherwise> | |
</xsl:choose> | |
</xsl:if> | |
</xsl:for-each> | |
</div> | |
</xsl:template> | |
<!-- end template match for FAQ snippet --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment