Skip to content

Instantly share code, notes, and snippets.

@allen allen/master.xml

forked from anonymous/master.xml
Created Nov 7, 2012
What would you like to do?
<?xml version="1.0" encoding="UTF-8"?>
<section id="20" handle="plant-of-the-month">plant of the month</section>
<entry id="99">
<genus handle="fgfg">fgfg</genus>
<common-name handle="ggfdgb">ggfdgb</common-name>
<latin-name handle="dghgh">dghgh</latin-name>
<xsl:stylesheet xmlns:xsl="" version="1.0">
<xsl:output method="xml" indent="yes" />
<xsl:template match="/">
<xsl:apply-templates select="data/plant-of-the-month/entry"/>
<xsl:template match="data/plant-of-the-month/entry">
<h3>Plant of the Month</h3>
<!-- Iterate over months -->
<xsl:for-each select="*[substring-before(name(), '-') = 'flowers']">
<!-- Pick out the month from the element name -->
<xsl:variable name="month" select="substring-after(name(), '-')"/>
<!-- Lower cases and upper cases used for translation -->
<xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>
<xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
<!-- Pick out the month from the element name and capitalize it -->
<xsl:variable name="cap-month" select="concat(translate(substring($month, 1, 1), $lower, $upper), substring($month, 2))"/>
<a class="btn" href="/plants/{$month}/">
<xsl:if test=". = 'Yes'">
<xsl:attribute name="class">btn btn-success</xsl:attribute>
<xsl:value-of select="$cap-month"/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.