Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.63 KB | None | 0 0
  1. <!-- begin template match for FAQ snippet -->
  2. <xsl:template match="table[@class='snippet-faq']" mode="copy">
  3. <div class="uthsc-faq">
  4. <xsl:for-each select="tbody/tr">
  5. <xsl:if test="position() > 3">
  6. <xsl:variable name="anchor-link">
  7. <xsl:choose>
  8. <xsl:when test="string-length(normalize-space(td[3])) > 1">
  9. <xsl:value-of select="lower-case(replace(replace(td[3], '[^a-zA-Z0-9 ]', ''),' ', '-'))" />
  10. </xsl:when>
  11. <xsl:otherwise>
  12. <xsl:value-of select="generate-id()" />
  13. </xsl:otherwise>
  14. </xsl:choose>
  15. </xsl:variable>
  16. <xsl:choose>
  17. <xsl:when test="starts-with(td[1],'heading')">
  18. <xsl:choose>
  19. <xsl:when test="ends-with(td[1],'1')">
  20. <h2 class="uthsc-faq-heading-1"><a href="#{$anchor-link}"><xsl:value-of select="td[2]/node()" /></a></h2>
  21. </xsl:when>
  22. <xsl:when test="ends-with(td[1],'2')">
  23. <h3 class="uthsc-faq-heading-2"><a href="#{$anchor-link}"><xsl:value-of select="td[2]/node()" /></a></h3>
  24. </xsl:when>
  25. </xsl:choose>
  26. </xsl:when>
  27. <xsl:otherwise>
  28. <p class="uthsc-faq-question"><a href="#{$anchor-link}"><xsl:value-of select="td[1]/node()" /></a></p>
  29. </xsl:otherwise>
  30. </xsl:choose>
  31. </xsl:if>
  32. </xsl:for-each>
  33. <div class="columns uthsc-row-title">
  34. <h2>Answers</h2>
  35. </div>
  36. <br style="clear:both;" />
  37. <xsl:for-each select="tbody/tr">
  38. <xsl:variable name="anchor-link">
  39. <xsl:choose>
  40. <xsl:when test="string-length(normalize-space(td[3])) > 1">
  41. <xsl:value-of select="lower-case(replace(replace(td[3], '[^a-zA-Z0-9 ]', ''),' ', '-'))" />
  42. </xsl:when>
  43. <xsl:otherwise>
  44. <xsl:value-of select="generate-id()" />
  45. </xsl:otherwise>
  46. </xsl:choose>
  47. </xsl:variable>
  48. <xsl:if test="position() > 3">
  49. <xsl:choose>
  50. <xsl:when test="starts-with(td[1],'heading')">
  51. <xsl:choose>
  52. <xsl:when test="ends-with(td[1],'1')">
  53. <h2 class="uthsc-faq-heading-1" id="{$anchor-link}"><xsl:value-of select="td[2]/node()" /></h2>
  54. </xsl:when>
  55. <xsl:when test="ends-with(td[1],'2')">
  56. <h3 class="uthsc-faq-heading-2" id="{$anchor-link}"><xsl:value-of select="td[2]/node()" /></h3>
  57. </xsl:when>
  58. </xsl:choose>
  59. </xsl:when>
  60. <xsl:otherwise>
  61. <div class="uthsc-faq-answer">
  62. <h4 class="uthsc-faq-answer-heading" id="{$anchor-link}"><xsl:value-of select="td[1]/node()" /></h4>
  63. <xsl:apply-templates select="td[2]/node()" mode="copy"/>
  64. </div>
  65. </xsl:otherwise>
  66. </xsl:choose>
  67. </xsl:if>
  68. </xsl:for-each>
  69. </div>
  70. </xsl:template>
  71. <!-- end template match for FAQ snippet -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement