]> git.draconx.ca Git - homepage.git/blob - layouts/default.xsl
5b9aa42a71118a08556c4da870b033d9b068148c
[homepage.git] / layouts / default.xsl
1 <?xml version='1.0' encoding='UTF-8' ?>
2 <!--
3   Nick's web site: Final XHTML output stage
4
5   Copyright © 2018 Nick Bowler
6
7   This program is free software: you can redistribute it and/or modify
8   it under the terms of the GNU General Public License as published by
9   the Free Software Foundation, either version 3 of the License, or
10   (at your option) any later version.
11
12   This program is distributed in the hope that it will be useful,
13   but WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   GNU General Public License for more details.
16
17   You should have received a copy of the GNU General Public License
18   along with this program.  If not, see <https://www.gnu.org/licenses/>
19 -->
20 <xsl:stylesheet version='1.0'
21   xmlns='http://www.w3.org/1999/xhtml'
22   xmlns:xhtml='http://www.w3.org/1999/xhtml'
23   xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
24   exclude-result-prefixes='xhtml'>
25
26 <xsl:output method='xml' encoding='UTF-8' indent='yes'
27   doctype-public='-//W3C//DTD XHTML 1.1//EN'
28   doctype-system='http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd' />
29 <xsl:strip-space elements='*' />
30
31 <xsl:param name='site-title' select='"The Citrine Citadel"' />
32
33 <xsl:template match='node()|@*'>
34   <xsl:copy><xsl:apply-templates select='node()|@*' /></xsl:copy>
35 </xsl:template>
36
37 <xsl:template match='/'>
38   <html>
39     <head>
40       <meta name='viewport' content='width=device-width, initial-scale=1' />
41       <link rel='stylesheet' type='text/css' href='/style.css' />
42       <title>
43         <xsl:variable name='page-title' select='string(/document/title)' />
44         <xsl:if test='$page-title and $site-title != $page-title'>
45           <xsl:value-of select='concat($page-title, " – ")' />
46         </xsl:if>
47         <xsl:value-of select='$site-title' />
48       </title>
49     </head>
50     <body>
51       <xsl:apply-templates select='/document/xhtml:html/@*' />
52       <xsl:apply-templates select='/document/xhtml:html/node()' />
53     </body>
54   </html>
55 </xsl:template>
56
57 </xsl:stylesheet>