|
| 1 | +--- |
| 2 | +layout: null |
| 3 | +source: 'http://www.evagoras.com/2011/02/10/improving-an-xml-feed-display-through-css-and-xslt/' |
| 4 | +breadcrumbs: true |
| 5 | +--- |
| 6 | +<?xml version="1.0" encoding="UTF-8"?> |
| 7 | +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" {{ page.stylesheetAttributes }}> |
| 8 | +<xsl:output method="html" encoding="utf-8" /> |
| 9 | +<xsl:template match="{{ page.rootMatcher }}"> |
| 10 | + <xsl:text disable-output-escaping="yes"><!DOCTYPE html ></xsl:text> |
| 11 | + <html> |
| 12 | + <head> |
| 13 | + <xsl:text disable-output-escaping="yes"><![CDATA[ |
| 14 | + {% include head.html %} |
| 15 | + ]]></xsl:text> |
| 16 | + </head> |
| 17 | + <body id="top-of-page"> |
| 18 | + <xsl:text disable-output-escaping="yes"><![CDATA[ |
| 19 | + {% include navigation.html %} |
| 20 | + {% include masthead.html %} |
| 21 | + {% include alert warning=page.disclaimer classes="text-center" %} |
| 22 | + ]]></xsl:text> |
| 23 | + {{ content }} |
| 24 | + <xsl:text disable-output-escaping="yes"><![CDATA[ |
| 25 | + {% include footer.html %} |
| 26 | + {% include footer_scripts.html %} |
| 27 | + ]]></xsl:text> |
| 28 | + </body> |
| 29 | + </html> |
| 30 | +</xsl:template> |
| 31 | +<xsl:template name="slugify"> |
| 32 | + <xsl:param name="text" select="''" /> |
| 33 | + <xsl:variable name="dodgyChars" select="' ,.#_-!?*:;=+|&/\\'" /> |
| 34 | + <xsl:variable name="replacementChar" select="'-----------------'" /> |
| 35 | + <xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz'" /> |
| 36 | + <xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" /> |
| 37 | + <xsl:variable name="lowercased"><xsl:value-of select="translate( $text, $uppercase, $lowercase )" /></xsl:variable> |
| 38 | + <xsl:variable name="escaped"><xsl:value-of select="translate( $lowercased, $dodgyChars, $replacementChar )" /></xsl:variable> |
| 39 | + <xsl:value-of select="$escaped" /> |
| 40 | +</xsl:template> |
| 41 | +</xsl:stylesheet> |
0 commit comments