Skip to content

Instantly share code, notes, and snippets.

@bauhouse
Created October 27, 2011 22:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save bauhouse/1321077 to your computer and use it in GitHub Desktop.
Save bauhouse/1321077 to your computer and use it in GitHub Desktop.
Master XSL Template with overrides
<?xml version="1.0" encoding="utf-8" ?>
<data>
<params>
<today>2011-10-27</today>
<current-time>16:00</current-time>
<this-year>2011</this-year>
<this-month>10</this-month>
<this-day>27</this-day>
<timezone>-07:00</timezone>
<website-name>Symphony CMS</website-name>
<page-title>Home</page-title>
<root>http://example.com</root>
<workspace>http://example.com/workspace</workspace>
<root-page>home</root-page>
<current-page>home</current-page>
<current-page-id>1</current-page-id>
<current-path>/?debug=xml</current-path>
<parent-path>/</parent-path>
<current-url>http://example.com/?debug=xml</current-url>
<upload-limit>2097152</upload-limit>
<symphony-version>2.2.4</symphony-version>
<cookie-username>username</cookie-username>
<cookie-pass>0000000000000000000000000000000000000000</cookie-pass>
<site-mode>live</site-mode>
</params>
<events />
</data>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="../utilities/master.xsl" />
<xsl:template match="data">
<h1><xsl:value-of select="$page-title"/></h1>
</xsl:template>
</xsl:stylesheet>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Symphony CMS</title>
<meta name="description" content="" />
<meta name="author" content="" />
</head>
<body id="home-page">
<div class="page">
<h1>Home</h1>
</div>
</body>
</html>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
omit-xml-declaration="yes"
encoding="UTF-8"
indent="yes" />
<xsl:template match="/">
<html lang="en">
<head>
<xsl:call-template name="head" />
</head>
<body id="{$current-page}-page">
<div class="page">
<xsl:apply-templates mode="header" />
<xsl:apply-templates mode="nav" />
<xsl:apply-templates mode="aside" />
<xsl:apply-templates />
<xsl:apply-templates mode="footer" />
<xsl:apply-templates mode="js" />
</div>
</body>
</html>
</xsl:template>
<xsl:template name="head">
<xsl:apply-templates mode="page-title" />
<meta name="description" content="" />
<meta name="author" content="" />
<xsl:apply-templates mode="css" />
</xsl:template>
<xsl:template match="data" mode="page-title">
<xsl:param name="site-name" select="$website-name" />
<title>
<!-- If not the homepage -->
<xsl:if test="$current-path != '/'">
<xsl:value-of select="$page-title" />
<xsl:text> | </xsl:text>
</xsl:if>
<xsl:value-of select="$site-name"/>
</title>
</xsl:template>
<xsl:template match="data" mode="css" />
<xsl:template match="data" mode="header" />
<xsl:template match="data" mode="nav" />
<xsl:template match="data" mode="aside" />
<xsl:template match="data" mode="footer" />
<xsl:template match="data" mode="js" />
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment