forked from bbcarchdev/docbook-html5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocbook-html5.xsl
113 lines (96 loc) · 4.36 KB
/
docbook-html5.xsl
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
<?xml version="1.0" encoding="utf-8"?>
<!--
Author: Mo McRoberts <[email protected]>
Copyright (c) 2014 BBC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xlink="http://www.w3.org/1999/xlink" exclude-result-prefixes="xhtml db xi xlink">
<xsl:output omit-xml-declaration="yes" encoding="utf-8" indent="no" />
<xsl:include href="block.xsl" />
<xsl:include href="inline.xsl" />
<xsl:include href="doc.xsl" />
<xsl:include href="toc.xsl" />
<!-- HTML5 doctype -->
<xsl:template name="html.doctype">
<xsl:text disable-output-escaping="yes"><![CDATA[<!DOCTYPE html>]]></xsl:text>
</xsl:template>
<!-- HTML5 meta elements -->
<xsl:template name="html.meta">
<xsl:text disable-output-escaping="yes"><![CDATA[
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta charset="utf-8" />
<!--[if lt IE 9]><script>document.createElement('header');document.createElement('nav');document.createElement('section');document.createElement('article');document.createElement('aside');document.createElement('footer');</script><![endif]-->
]]></xsl:text>
</xsl:template>
<!-- HTML5 stylesheets -->
<xsl:param name="html.linksfile" select="''" />
<xsl:param name="html.ie78css" select="''" />
<xsl:param name="html.ie78script" select="''" />
<xsl:template name="html.links">
<xsl:if test="normalize-space($html.linksfile) != ''">
<xsl:call-template name="include-xml">
<xsl:with-param name="uri" select="$html.linksfile" />
</xsl:call-template>
</xsl:if>
<xsl:if test="normalize-space($html.ie78css) != ''">
<xsl:text disable-output-escaping="yes"><![CDATA[<!--[if lt IE 9]><link rel="stylesheet" type="text/css" href="]]></xsl:text>
<xsl:value-of select="$html.ie78css" />
<xsl:text disable-output-escaping="yes"><![CDATA[" /><![endif]-->]]></xsl:text>
</xsl:if>
<xsl:if test="normalize-space($html.ie78script) != ''">
<xsl:text disable-output-escaping="yes"><![CDATA[<!--[if lt IE 9]><script src="]]></xsl:text>
<xsl:value-of select="$html.ie78script" />
<xsl:text disable-output-escaping="yes"><![CDATA["></script><![endif]-->]]></xsl:text>
</xsl:if>
</xsl:template>
<!-- HTML5 scripts -->
<xsl:param name="html.script" select="''" />
<xsl:template name="html.scripts">
<xsl:if test="normalize-space($html.script) != ''">
<xsl:text disable-output-escaping="yes"><![CDATA[<script src="]]></xsl:text>
<xsl:value-of select="$html.script" />
<xsl:text disable-output-escaping="yes"><![CDATA["></script>]]></xsl:text>
</xsl:if>
</xsl:template>
<!-- Global navigation -->
<xsl:param name="html.navfile" select="''" />
<xsl:template name="html.globalnav">
<xsl:if test="normalize-space($html.navfile) != ''">
<nav class="global"><div class="inner">
<xsl:call-template name="include-xml">
<xsl:with-param name="uri" select="$html.navfile" />
</xsl:call-template>
</div></nav>
</xsl:if>
</xsl:template>
<xsl:param name="html.subnavfile" select="''" />
<xsl:template name="html.subnav">
<xsl:if test="normalize-space($html.subnavfile) != ''">
<nav class="secondarynav"><div class="inner">
<xsl:call-template name="include-xml">
<xsl:with-param name="uri" select="$html.subnavfile" />
</xsl:call-template>
</div></nav>
</xsl:if>
</xsl:template>
<!-- Masthead -->
<xsl:template name="html.masthead">
<xsl:text disable-output-escaping="yes"><![CDATA[
<div class="masthead"></div>
]]></xsl:text>
</xsl:template>
<!-- Utilities -->
<xsl:template name="include-xml">
<xsl:param name="uri" />
<xsl:message>Including source file <xsl:value-of select="$uri" /></xsl:message>
<xsl:copy-of select="document($uri)/include/*" disable-output-escaping="yes" />
</xsl:template>
</xsl:stylesheet>