Skip to content

Instantly share code, notes, and snippets.

@greystate
Created January 21, 2011 10:31
Show Gist options
  • Save greystate/789512 to your computer and use it in GitHub Desktop.
Save greystate/789512 to your computer and use it in GitHub Desktop.
A way to fake including multiple stylesheets and choosing which to use
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:umb="urn:umbraco.library"
exclude-result-prefixes="umb"
>
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />
<xsl:param name="currentPage" />
<xsl:variable name="siteRoot" select="$currentPage/ancestor-or-self::Website" />
<xsl:variable name="guitarStyle" select="/macro/playingStyle" />
<xsl:template match="/">
<!-- These are mutually exclusive -->
<xsl:apply-templates select="$currentPage[$guitarStyle = 'blues']" mode="blues" />
<xsl:apply-templates select="$currentPage[$guitarStyle = 'metal']" mode="metal" />
<xsl:apply-templates select="$currentPage[$guitarStyle = 'jazz']" mode="jazz" />
</xsl:template>
<!-- Including all styles of awesome guitar playing -->
<xsl:include href="_guitarStyles_blues.xslt" />
<xsl:include href="_guitarStyles_metal.xslt" />
<xsl:include href="_guitarStyles_jazz.xslt" />
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment