Skip to content

Instantly share code, notes, and snippets.

@stentebjerg
Created October 17, 2013 09:02
Show Gist options
  • Save stentebjerg/7021585 to your computer and use it in GitHub Desktop.
Save stentebjerg/7021585 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:Examine="urn:Examine"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets Examine ">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:template match="TextCenter">
<section class="TextCenter" data-view="TextCenter">
<xsl:attribute name="data-url">
<xsl:value-of select="@urlName"/>
</xsl:attribute>
<xsl:attribute name="data-id">
<xsl:value-of select="@urlName"/>
</xsl:attribute>
<xsl:attribute name="data-video">
<xsl:if test="normalize-space(video)">
<xsl:value-of select="umbraco.library:GetMedia(video, 0)/umbracoFile" />
</xsl:if>
</xsl:attribute>
<xsl:attribute name="data-image">
<xsl:choose>
<xsl:when test="normalize-space(image)">
<xsl:value-of select="umbraco.library:GetMedia(image, 0)/umbracoFile" />
</xsl:when>
<xsl:otherwise>
<xsl:text>/img/backgrounds/empty.gif</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="data-primary-color">
<xsl:choose>
<xsl:when test="normalize-space(primaryColor)">
<xsl:text>#</xsl:text>
<xsl:value-of select="primaryColor"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>#ffffff</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="data-secondary-color">
<xsl:choose>
<xsl:when test="normalize-space(secondaryColor)">
<xsl:text>#</xsl:text>
<xsl:value-of select="secondaryColor"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>#ffffff</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="data-top-menu-color">
<xsl:if test="normalize-space(topMenuColor)">
<xsl:text>#</xsl:text>
<xsl:value-of select="topMenuColor"/>
</xsl:if>
</xsl:attribute>
<xsl:attribute name="data-logo-color">
<xsl:if test="normalize-space(logoColor)">
<xsl:text>#</xsl:text>
<xsl:value-of select="logoColor"/>
</xsl:if>
</xsl:attribute>
<xsl:attribute name="data-text-color">
<xsl:if test="normalize-space(textColor)">
<xsl:text>#</xsl:text>
<xsl:value-of select="textColor"/>
</xsl:if>
</xsl:attribute>
<xsl:attribute name="data-text-secondary-color">
<xsl:if test="normalize-space(textSecondaryColor)">
<xsl:text>#</xsl:text>
<xsl:value-of select="textSecondaryColor"/>
</xsl:if>
</xsl:attribute>
<xsl:attribute name="data-button-color">
<xsl:if test="normalize-space(buttonColor)">
<xsl:text>#</xsl:text>
<xsl:value-of select="buttonColor"/>
</xsl:if>
</xsl:attribute>
<xsl:attribute name="data-button-text-color">
<xsl:if test="normalize-space(buttonTextColor)">
<xsl:text>#</xsl:text>
<xsl:value-of select="buttonTextColor"/>
</xsl:if>
</xsl:attribute>
<xsl:attribute name="data-background-color">
<xsl:if test="normalize-space(backgroundColor)">
<xsl:text>#</xsl:text>
<xsl:value-of select="backgroundColor"/>
</xsl:if>
</xsl:attribute>
<div class="centerWrapper">
<div class="centerInner">
<xsl:if test="normalize-space(headline)">
<h2><xsl:value-of select="headline" disable-output-escaping="yes"/></h2>
</xsl:if>
<xsl:if test="normalize-space(subheadline)">
<h3 class="secondaryText"><xsl:value-of select="subheadline"/></h3>
</xsl:if>
<xsl:if test="normalize-space(cta/url-picker/link-title)">
<a href="{cta/url-picker/url}" class="btn"><xsl:value-of select="cta/url-picker/link-title"/></a>
</xsl:if>
<xsl:if test="nextSectionButton !=0">
<a href="javascript:void(null);" class="nextSectionBtn"><xsl:value-of select="empty"/></a>
</xsl:if>
</div>
</div>
</section>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment