-
-
Save greystate/7028916 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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]> | |
<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"/> | |
<!-- Map property names to a data-attribute names --> | |
<xsl:variable name="nameProxy"> | |
<map propertyName="primaryColor" attr="primary-color" /> | |
<map propertyName="secondaryColor" attr="secondary-color" /> | |
<map propertyName="topMenuColor" attr="top-menu-color" /> | |
<map propertyName="logoColor" attr="logo-color" /> | |
<map propertyName="textColor" attr="text-color" /> | |
<map propertyName="textSecondaryColor" attr="text-secondary-color" /> | |
<map propertyName="buttonColor" attr="button-color" /> | |
<map propertyName="buttonTextColor" attr="button-text-color" /> | |
<map propertyName="backgroundColor" attr="background-color" /> | |
</xsl:variable> | |
<xsl:variable name="mapper" select="msxml:node-set($nameProxy)/map" /> | |
<xsl:template match="TextCenter"> | |
<section | |
class="TextCenter" data-view="TextCenter" | |
data-url="{@urlName}" | |
data-id="{@urlName}" | |
data-image="/img/backgrounds/empty.gif" | |
data-primary-color="#ffffff" | |
data-secondary-color="#ffffff" | |
> | |
<xsl:apply-templates select="video" /> | |
<xsl:apply-templates select="image" /> | |
<xsl:apply-templates select="primaryColor" /> | |
<xsl:apply-templates select="secondaryColor" /> | |
<xsl:apply-templates select="topMenuColor" /> | |
<xsl:apply-templates select="logoColor" /> | |
<xsl:apply-templates select="textColor" /> | |
<xsl:apply-templates select="textSecondaryColor" /> | |
<xsl:apply-templates select="buttonColor" /> | |
<xsl:apply-templates select="buttonTextColor" /> | |
<xsl:apply-templates select="backgroundColor" /> | |
<div class="centerWrapper"> | |
<div class="centerInner"> | |
<xsl:apply-templates select="headline" /> | |
<xsl:apply-templates select="subheadline" /> | |
<xsl:apply-templates select="cta/url-picker[normalize-space(link-title)]" /> | |
<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:template match="video | image"> | |
<xsl:attribute name="data-{name()}"> | |
<xsl:value-of select="umbraco.library:GetMedia(., false())/umbracoFile" /> | |
</xsl:attribute> | |
</xsl:template> | |
<xsl:template match="primaryColor | secondaryColor | topMenuColor | logoColor | textColor | textSecondaryColor | buttonColor | buttonTextColor | backgroundColor"> | |
<xsl:variable name="attributeName" select="$mapper[@propertyName = name(current())]/@attr" /> | |
<xsl:attribute name="data-{$attributeName}"> | |
<xsl:value-of select="concat('#', .)" /> | |
</xsl:attribute> | |
</xsl:template> | |
<xsl:template match="headline"> | |
<h2><xsl:value-of select="." disable-output-escaping="yes" /></h2> | |
</xsl:template> | |
<xsl:template match="subheadline"> | |
<h3 class="secondaryText"><xsl:value-of select="." /></h3> | |
</xsl:template> | |
<xsl:template match="url-picker"> | |
<a href="{url}" class="btn"><xsl:value-of select="link-title"/></a> | |
</xsl:template> | |
<!-- Do not output empty elements --> | |
<xsl:template match="TextCenter/*[not(normalize-space())]" priority="-1" /> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment