-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathhtml5.xsl
More file actions
286 lines (244 loc) · 13.3 KB
/
html5.xsl
File metadata and controls
286 lines (244 loc) · 13.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Imports SAM XSL templates -->
<xsl:import href="../admin/xsl-library/master-import.xsl" />
<!-- Set the character set -->
<xsl:output method="html" encoding="utf-8" indent="yes" media-type="text/html; charset=utf-8" />
<!-- Params that are passed to XSL from SAM -->
<xsl:param name="browsemode" select="'edit'" />
<xsl:param name="userlogin" select="1" />
<xsl:param name="version" select="xxx" />
<xsl:param name="menumode" select="1" />
<xsl:param name="bucket" select="Inline" />
<xsl:param name="debug" select="1" />
<xsl:param name="debugtext" select="1" />
<xsl:param name="messagetext" />
<xsl:param name="action" />
<xsl:param name="cwidth" />
<!-- google analytics ID -->
<xsl:variable name="gaTrackingID">xx-xxxxxx-x</xsl:variable>
<!-- Some handy variables for later -->
<xsl:variable name="myPageID"><xsl:value-of select="/SAM/page/@id"/></xsl:variable>
<xsl:variable name="myHomePageID"><xsl:value-of select="/SAM/page/navigation/breadcrumb[position() = 2]/@link-id" /></xsl:variable>
<xsl:variable name="myPrimaryPageID"><xsl:value-of select="/SAM/page/navigation/breadcrumb[position() = 3]/@link-id" /></xsl:variable>
<xsl:variable name="mySecondaryPageID"><xsl:value-of select="/SAM/page/navigation/breadcrumb[position() = 4]/@link-id" /></xsl:variable>
<xsl:variable name="hasSidebar"><xsl:if test="count(/SAM/page/chunk/meta[@name='Content-Group' and value='Sidebar']) > 0">true</xsl:if></xsl:variable>
<xsl:variable name="depth"><xsl:value-of select="/SAM/page/navigation/breadcrumb[position() = last()]/@depth" /></xsl:variable>
<xsl:variable name="bodyClass">pid<xsl:value-of select="/SAM/page/@id" /> sam<xsl:value-of select="/SAM/@directive"/>
<xsl:if test="/SAM/page/@id != $myHomePageID"> depth<xsl:value-of select="$depth" /></xsl:if>
<xsl:if test="$myPrimaryPageID != ''"> primary<xsl:value-of select="$myPrimaryPageID" /> </xsl:if>
<xsl:if test="$mySecondaryPageID != ''"> secondary<xsl:value-of select="$mySecondaryPageID" /> </xsl:if>
<xsl:if test="/SAM/page/@id = $myHomePageID"> home</xsl:if>
<xsl:if test="$hasSidebar = 'true'"> hasSidebar</xsl:if>
</xsl:variable>
<!-- The entry point for the template -->
<xsl:template match="/SAM">
<!-- Set the DOCTYPE targeting HTML5 -->
<xsl:text disable-output-escaping='yes'><!DOCTYPE html></xsl:text>
<!-- HTML tag with conditional classes for "those" browsers -->
<xsl:text disable-output-escaping='yes'><![CDATA[
<!--[if lt IE 7 ]><html lang="en" class="ie6"> <![endif]-->
<!--[if IE 7 ]><html lang="en" class="ie7"> <![endif]-->
<!--[if IE 8 ]><html lang="en" class="ie8"> <![endif]-->
<!--[if IE 9 ]><html lang="en" class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--><html lang="en"><!--<![endif]-->
]]></xsl:text>
<head>
<!-- SAM code and cache controls -->
<xsl:if test="@directive = 'admin'">
<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="expires" content="-1" />
<xsl:call-template name="admin-script" />
</xsl:if>
<!-- Charset and browser compatability tags -->
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<!-- Track events that are triggered before Analytics load -->
<xsl:if test="@directive = 'publish'"><script>
var _gaq=[['_setAccount','<xsl:value-of select="$gaTrackingID" />'],['_trackPageview']];
</script></xsl:if>
<!-- We use the page title from SAM. That can be prepended to or altered here -->
<title><xsl:value-of select="/SAM/page/title" disable-output-escaping="yes" /></title>
<!-- Canonical tag -->
<link rel="canonical">
<xsl:attribute name="href">
<xsl:choose>
<xsl:when test="/SAM/navigation/link[@id = /SAM/page/@id]/href-override">
<xsl:value-of select="/SAM/navigation/link[@id = /SAM/page/@id]/href-override" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="/SAM/sites/site[@root-pageid = $myHomePageID]/publish-url" />
<xsl:text>/</xsl:text>
<xsl:value-of select="/SAM/navigation/link[@id = /SAM/page/@id]/href" />
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</link>
<!-- Common meta tags -->
<xsl:choose>
<xsl:when test="(/SAM/page/@noindex = 1 and /SAM/page/@nofollow = 1) or @directive != 'publish'">
<meta name="robots" content="nofollow, noindex, noarchive" />
</xsl:when>
<xsl:when test="/SAM/page/@noindex = 0 and /SAM/page/@nofollow = 1">
<meta name="robots" content="nofollow" />
</xsl:when>
<xsl:when test="/SAM/page/@noindex = 1 and /SAM/page/@nofollow = 0">
<meta name="robots" content="noindex, noarchive" />
</xsl:when>
</xsl:choose>
<meta name="author" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Favicon and touch icon links -->
<!--<link rel="shortcut icon" href="/favicon.ico" />-->
<!--<link rel="apple-touch-icon" href="/apple-touch-icon.png" />-->
<!-- These meta keywords and description fields concatenate chunk and page metadata that is defined in SAM -->
<meta name="keywords"><xsl:attribute name="content"><xsl:for-each select="/SAM/page/keywords"><xsl:value-of select="." /></xsl:for-each><xsl:for-each select="/SAM/page/chunk/meta[@name = 'Keywords']"><xsl:value-of select="value" /></xsl:for-each></xsl:attribute></meta>
<meta name="description"><xsl:attribute name="content"><xsl:for-each select="/SAM/page/description"><xsl:value-of select="." /></xsl:for-each><xsl:for-each select="/SAM/page/chunk/meta[@name = 'Description']"><xsl:value-of select="value" /></xsl:for-each></xsl:attribute></meta>
<!-- This calls all stylesheets that are linkes in SAM. Stylesheets may be linkes with sites, pages or even content chunks -->
<xsl:call-template name="getStyles" />
<!-- Boilerplate styles -->
<style type="text/css">
/* This style definition is necessary for IE to render these elements properly */
article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block;}
/* All these styles should be replaced */
body {margin:0;padding:0;font-family:verdana,arial,sans-serif;font-size:12px;}
p {margin-top:0;}
header {background-color:#ddd;height:140px;}
section {position:relative;margin:24px 0 0 0;float:left;width:768px;}
.hasSidebar section {width:508px;}
aside { float:right;width:240px;margin-top:24px;}
footer {background-color:#ddd;}
nav.primaryNav {background-color:#888;}
nav.primaryNav ul { list-style-type:none;margin:0;}
nav.primaryNav ul li { float:left;padding:8px;margin:0 2px;border-style:solid;border-width:1px;border-color:#666;background-color:#ddd;}
nav.leftNav {position:relative;float:left;width:240px;margin-top:24px;}
nav.leftNav ul { list-style-type:none; margin:0;padding:4px 0 0 24px;}
nav.leftNav ul li { padding:2px 0 2px 3px;}
nav.breadcrumbs {background-color:#ccc;}
nav.breadcrumbs ul { margin:0;list-style-type:none;}
nav.breadcrumbs ul li { float:left;padding:4px;margin:0 2px;border-style:solid;border-width:0 0 0 1px;border-color:#666;}
.footerCol {width:180px;padding:20px 20px 10px 0;float:left;}
footer ul { padding:0;margin:0;list-style-type:none;}
footer ul li {margin:0;padding:2px 0 2px 3px;}
.pageContainer {background-color:#aaa;}
.pageWidth {width:1028px;margin:auto;}
.clear {clear:both;}
.content {background-color:#fff;}
</style>
<!-- call to Remy Sharp's HTML5 Shim for IE -->
<xsl:text disable-output-escaping='yes'><![CDATA[
<!--[if lt IE 9]><script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
]]></xsl:text>
<!-- Call to Modernizr (more: http://www.modernizr.com/) -->
<script src="/js/lib/modernizr-2.8.3.min.js"></script>
</head>
<body class="{$bodyClass}">
<!-- SAM Administration tools -->
<xsl:call-template name="SAM-admin" />
<!-- The body of the page -->
<div class="pageContainer">
<xsl:call-template name="header" />
<xsl:call-template name="primaryNav" />
<div class="content pageWidth">
<xsl:call-template name="leftNav" />
<xsl:call-template name="inline" />
<xsl:call-template name="sidebar" />
<div class="clear"></div>
</div>
<xsl:call-template name="breadcrumbs"></xsl:call-template>
<xsl:call-template name="footerNav"></xsl:call-template>
</div>
<!-- Call to jQuery with backup call to local copy if Google API fails. Also includes noConflict which is mandatory in SAM for the time being (conflicts with Prototype) -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script><xsl:text disable-output-escaping="yes"><![CDATA[!window.jQuery && document.write(unescape('%3Cscript src="/js/lib/jquery-1.11.1.min.js"%3E%3C/script%3E'))]]></xsl:text></script>
<script>jQuery.noConflict();</script>
<!-- Call to your javascript -->
<!--<script src="/js/yourscript.js"></script>-->
<!-- Google Analytics code -->
<xsl:call-template name="googleAnalytics">
<xsl:with-param name="trackingID" select="$gaTrackingID" />
<xsl:with-param name="visitorIDSlot" select="1" />
<xsl:with-param name="trackKeywordRanking" select="true()" />
<xsl:with-param name="trackFileDownloads" select="true()" />
<xsl:with-param name="trackExternalLinks" select="true()" />
<xsl:with-param name="trackMailtos" select="true()" />
<xsl:with-param name="displayAdvertiserSupport" select="true()" />
</xsl:call-template>
</body>
<!-- Closing html tag -->
<xsl:text disable-output-escaping="yes"><![CDATA[</html>]]></xsl:text>
</xsl:template>
<!-- Page header. Here we wrap the header around a <div class="pageWidth"> to give us an element that extends into margins but contains the contents within the page width -->
<xsl:template name="header">
<header>
<div class="pageWidth">
<p>Header</p>
</div>
</header>
</xsl:template>
<!-- Primary Navigation. Uses pagewidth trick described above -->
<xsl:template name="primaryNav">
<nav class="primaryNav">
<div class="pageWidth">
<xsl:call-template name="ulNavigation" />
<div class="clear" />
</div>
</nav>
</xsl:template>
<!-- Left hand navigation. This entire template is wrapped within the <div class="pageWidth"> along with inline and right sidebar. These elements do not extend into page margin -->
<xsl:template name="leftNav">
<nav class="leftNav">
<xsl:call-template name="ulNavigation">
<xsl:with-param name="parent" select="$myPrimaryPageID" />
<xsl:with-param name="depth" select="9999" />
</xsl:call-template>
</nav>
</xsl:template>
<!-- Main content area -->
<xsl:template name="inline">
<section class="inline">
<xsl:call-template name="bucket-handler">
<xsl:with-param name="bucket-label">Inline</xsl:with-param>
<xsl:with-param name="class" select="concat($bodyClass,' inline')" />
</xsl:call-template>
</section>
</xsl:template>
<!-- Sidebar content area -->
<xsl:template name="sidebar">
<aside class="sidebar">
<xsl:call-template name="bucket-handler">
<xsl:with-param name="bucket-label">Sidebar</xsl:with-param>
<xsl:with-param name="class" select="concat($bodyClass,' sidebar')" />
</xsl:call-template>
</aside>
</xsl:template>
<!-- Breadcrumbs template. Uses same margin trick described for the header -->
<xsl:template name="breadcrumbs">
<nav class="breadcrumbs">
<div class="pageWidth">
<xsl:call-template name="ulBreadcrumbs" />
<div class="clear" />
</div>
</nav>
</xsl:template>
<!-- Footer Navigation template. Uses same margin trick described for the header -->
<xsl:template name="footerNav">
<footer>
<div class="pageWidth">
<!-- Here We're just looping through the firt 5 primary pages and outputing ulNavigation for each -->
<xsl:for-each select="/SAM/navigation/link[@parent-id = $myHomePageID and @navigable=1]">
<xsl:if test="position() < 6">
<div class="footerCol">
<p><xsl:call-template name="navigation-link" /></p>
<xsl:call-template name="ulNavigation">
<xsl:with-param name="parent" select="@id" />
<xsl:with-param name="idPrefix" select="'footer'" />
</xsl:call-template>
</div>
</xsl:if>
</xsl:for-each>
<div class="clear"></div>
</div>
</footer>
</xsl:template>
</xsl:stylesheet>