summaryrefslogtreecommitdiff
path: root/stylesheets/db2html-title.xsl
blob: defdd417fc1c3192ec8402d3cedef33b71e93858 (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
<?xml version='1.0'?><!-- -*- Mode: fundamental; tab-width: 3 -*- -->
<!DOCTYPE xsl:stylesheet [
<!ENTITY is-info "
(name(.) = 'appendixinfo')     or (name(.) = 'articleinfo')        or
(name(.) = 'bibliographyinfo') or (name(.) = 'blockinfo')          or
(name(.) = 'bookinfo')         or (name(.) = 'chapterinfo')        or
(name(.) = 'glossaryinfo')     or (name(.) = 'indexinfo')          or
(name(.) = 'objectinfo')       or (name(.) = 'partinfo')           or
(name(.) = 'prefaceinfo')      or (name(.) = 'refentryinfo')       or
(name(.) = 'referenceinfo')    or (name(.) = 'refsect1info')       or
(name(.) = 'refsect2info')     or (name(.) = 'refsect3info')       or
(name(.) = 'refsectioninfo')   or (name(.) = 'refsynopsisdivinfo') or
(name(.) = 'sect1info')        or (name(.) = 'sect2info')          or
(name(.) = 'sect3info')        or (name(.) = 'sect4info')          or
(name(.) = 'sect5info')        or (name(.) = 'sectioninfo')        or
(name(.) = 'setinfo')          or (name(.) = 'setindexinfo')       or
(name(.) = 'sidebarinfo')      ">
]>

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

<!-- ======================================================================= -->

<xsl:template mode="title.text.mode" match="*">
	<xsl:choose>
		<xsl:when test="title">
			<xsl:value-of select="title"/>
		</xsl:when>
		<xsl:when test="(&is-info;) and ../title">
			<xsl:value-of select="../title"/>
		</xsl:when>
		<xsl:when test="*[&is-info;]/title">
			<xsl:value-of select="*[&is-info;]/title"/>
		</xsl:when>
		<xsl:otherwise>
			<xsl:apply-templates select="." mode="node.header.inline.mode"/>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

<xsl:template mode="title.text.mode" match="refentry">
	<xsl:choose>
		<xsl:when test="refmeta/refentrytitle">
			<xsl:value-of select="refmeta/refentrytitle"/>
		</xsl:when>
		<xsl:when test="refentryinfo/title">
			<xsl:value-of select="refentryinfo/title"/>
		</xsl:when>
		<xsl:otherwise>
			<xsl:apply-templates select="." mode="node.header.inline.mode"/>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

<!-- ======================================================================= -->

<xsl:template mode="titleabbrev.text.mode" match="*">
	<xsl:choose>
		<xsl:when test="titleabbrev">
			<xsl:value-of select="titleabbrev"/>
		</xsl:when>
		<xsl:when test="(&is-info;) and ../titleabbrev">
			<xsl:value-of select="../titleabbrev"/>
		</xsl:when>
		<xsl:when test="*[&is-info;]/titleabbrev">
			<xsl:value-of select="*[&is-info;]/titleabbrev"/>
		</xsl:when>
		<xsl:otherwise>
			<xsl:apply-templates select="." mode="title.text.mode"/>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

<!-- ======================================================================= -->

<xsl:template mode="title.inline.mode" match="*">
	<xsl:choose>
		<xsl:when test="title">
			<xsl:apply-templates select="title/node()"/>
		</xsl:when>
		<xsl:when test="(&is-info;) and ../title">
			<xsl:apply-templates select="../title/node()"/>
		</xsl:when>
		<xsl:when test="*[&is-info;]/title">
			<xsl:apply-templates select="*[&is-info;]/title/node()"/>
		</xsl:when>
		<xsl:otherwise>
			<xsl:apply-templates select="." mode="node.header.inline.mode"/>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

<xsl:template mode="title.inline.mode" match="refentry">
	<xsl:choose>
		<xsl:when test="refmeta/refentrytitle">
			<xsl:value-of select="refmeta/refentrytitle"/>
		</xsl:when>
		<xsl:when test="refentryinfo/title">
			<xsl:value-of select="refentryinfo/title"/>
		</xsl:when>
		<xsl:otherwise>
			<xsl:apply-templates select="." mode="node.header.inline.mode"/>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

<!-- ======================================================================= -->

<xsl:template mode="titleabbrev.inline.mode" match="*">
	<xsl:choose>
		<xsl:when test="titleabbrev">
			<xsl:apply-templates select="titleabbrev/node()"/>
		</xsl:when>
		<xsl:when test="(&is-info;) and ../titleabbrev">
			<xsl:apply-templates select="../titleabbrev/node()"/>
		</xsl:when>
		<xsl:when test="*[&is-info;]/titleabbrev">
			<xsl:apply-templates select="*[&is-info;]/titleabbrev/node()"/>
		</xsl:when>
		<xsl:otherwise>
			<xsl:apply-templates select="." mode="title.inline.mode"/>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

<!-- ======================================================================= -->

</xsl:stylesheet>