summaryrefslogtreecommitdiff
path: root/stylesheets/yelp-customization.xsl
blob: 969728ea36492c79684e3f9f2beb570abae07e2d (plain)
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
<?xml version='1.0'?><!-- -*- Mode: fundamental; tab-width: 3 -*- -->
<!DOCTYPE xsl:stylesheet [
<!ENTITY is-division "
	(name(.) = 'appendix')   or (name(.) = 'article')      or
	(name(.) = 'book')       or (name(.) = 'bibliography') or
	(name(.) = 'chapter')    or (name(.) = 'colophon')     or
	(name(.) = 'glossary')   or (name(.) = 'index')        or
	(name(.) = 'part')       or (name(.) = 'preface')      or
	(name(.) = 'reference')  or (name(.) = 'refentry')     or
	(name(.) = 'refsect1')   or (name(.) = 'refsect2')     or
	(name(.) = 'refsect3')   or (name(.) = 'refsection')   or
	(name(.) = 'sect1')      or (name(.) = 'sect2')        or
	(name(.) = 'sect3')      or (name(.) = 'sect4')        or
	(name(.) = 'sect5')      or (name(.) = 'section')      or
	(name(.) = 'set')        or (name(.) = 'setindex')     or
	(name(.) = 'simplesect') ">
]>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version='1.0'>

<xsl:include href="db2html.xsl"/>

<xsl:template match="/">
	<xsl:variable name="node" select="*"/>
	<html>
		<head>
			<title>
				<xsl:apply-templates select="$node" mode="title.text.mode"/>
			</title>
			<style type="text/css">
				<xsl:call-template name="html.css">
					<xsl:with-param name="node" select="$node"/>
				</xsl:call-template>
			</style>
			<xsl:call-template name="html.head">
				<xsl:with-param name="node" select="$node"/>
			</xsl:call-template>
		</head>
		<body>
			<xsl:call-template name="html.body.attributes">
				<xsl:with-param name="node" select="$node"/>
			</xsl:call-template>
			<xsl:call-template name="html.body.top">
				<xsl:with-param name="node" select="$node"/>
			</xsl:call-template>

			<xsl:comment> End of header </xsl:comment>
			<xsl:apply-templates select="book | article" mode="chunk.mode"/>
			<xsl:comment> Start of footer </xsl:comment>

			<xsl:call-template name="html.body.bottom">
				<xsl:with-param name="node" select="$node"/>
			</xsl:call-template>
		</body>
	</html>
</xsl:template>

<xsl:template name="chunk">
	<xsl:param name="node" select="."/>
	<xsl:param name="info" select="false()"/>
	<xsl:param name="divisions" select="false()"/>
	<xsl:param name="id">
		<xsl:choose>
			<xsl:when test="$node = /*">
				<xsl:text>toc</xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$node/@id"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:param>

	<xsl:comment> Start of chunk: [<xsl:value-of select="$id"/>] </xsl:comment>
	<xsl:call-template name="html">
		<xsl:with-param name="node" select="$node"/>
		<xsl:with-param name="leaf" select="
			count($node/ancestor::*[&is-division;]) &gt;= $chunk_depth"/>
	</xsl:call-template>
	<xsl:comment> End of chunk </xsl:comment>

	<xsl:if test="$generate_titlepage and $info and ($node = /*)">
		<xsl:apply-templates select="$info" mode="chunk.mode"/>
	</xsl:if>

	<xsl:if test="count($node/ancestor::*[&is-division;]) &lt; $chunk_depth">
		<xsl:apply-templates select="$divisions" mode="chunk.mode"/>
	</xsl:if>
</xsl:template>

<xsl:template name="html">
	<xsl:param name="node" select="."/>
	<xsl:param name="leaf" select="true()"/>
	<xsl:variable name="prevlink">
		<xsl:apply-templates select="$node" mode="navbar.prev.link.mode"/>
	</xsl:variable>
	<xsl:variable name="nextlink">
		<xsl:apply-templates select="$node" mode="navbar.next.link.mode"/>
	</xsl:variable>

	<div>
		<xsl:call-template name="html.navbar.top">
			<xsl:with-param name="node" select="$node"/>
			<xsl:with-param name="prevlink" select="$prevlink"/>
			<xsl:with-param name="nextlink" select="$nextlink"/>
		</xsl:call-template>

		<xsl:apply-templates select="$node">
			<xsl:with-param name="depth" select="0"/>
			<xsl:with-param name="leaf" select="$leaf"/>
		</xsl:apply-templates>

		<xsl:call-template name="html.navbar.bottom">
			<xsl:with-param name="node" select="$node"/>
			<xsl:with-param name="prevlink" select="$prevlink"/>
			<xsl:with-param name="nextlink" select="$nextlink"/>
		</xsl:call-template>
	</div>
</xsl:template>

<xsl:template name="xref.target">
	<xsl:param name="linkend" select="@linkend"/>
	<xsl:param name="target" select="id($linkend)"/>
	<xsl:variable name="chunk_id">
		<xsl:apply-templates select="$target" mode="chunk.id.mode"/>
	</xsl:variable>
	<xsl:text>ghelp:</xsl:text>
	<xsl:value-of select="$doc_name"/>
	<xsl:text>?</xsl:text>
	<xsl:value-of select="$chunk_id"/>
</xsl:template>

</xsl:stylesheet>