blob: 437842e415d957c361948f1a959c836ab38a1b90 (
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
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
|
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:rx="http://www.renderx.com/XSL/Extensions"
version='1.0'>
<!-- ********************************************************************
$Id$
********************************************************************
(c) Stephane Bline Peregrine Systems 2001
Implementation of xep extensions:
* Pdf bookmarks (based on the XEP 2.5 implementation)
* Document information (XEP 2.5 meta information extensions)
******************************************************************** -->
<!-- FIXME: Norm, I changed things so that the top-level element (book or set)
does not appear in the TOC. Is this the right thing? -->
<xsl:template name="xep-document-information">
<rx:meta-info>
<xsl:variable name="authors"
select="(//author|//editor|//corpauthor|//authorgroup)[1]"/>
<xsl:if test="$authors">
<xsl:variable name="author">
<xsl:choose>
<xsl:when test="$authors[self::authorgroup]">
<xsl:call-template name="person.name.list">
<xsl:with-param name="person.list"
select="$authors/*[self::author|self::corpauthor|
self::othercredit|self::editor]"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$authors[self::corpauthor]">
<xsl:value-of select="$authors"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="person.name">
<xsl:with-param name="node" select="$authors"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:element name="rx:meta-field">
<xsl:attribute name="name">author</xsl:attribute>
<xsl:attribute name="value">
<xsl:value-of select="normalize-space($author)"/>
</xsl:attribute>
</xsl:element>
</xsl:if>
<xsl:variable name="title">
<xsl:apply-templates select="/*[1]" mode="label.markup"/>
<xsl:apply-templates select="/*[1]" mode="title.markup"/>
</xsl:variable>
<xsl:element name="rx:meta-field">
<xsl:attribute name="name">creator</xsl:attribute>
<xsl:attribute name="value">
<xsl:text>DocBook </xsl:text>
<xsl:value-of select="$DistroTitle"/>
<xsl:text> V</xsl:text>
<xsl:value-of select="$VERSION"/>
</xsl:attribute>
</xsl:element>
<xsl:element name="rx:meta-field">
<xsl:attribute name="name">title</xsl:attribute>
<xsl:attribute name="value">
<xsl:value-of select="normalize-space($title)"/>
</xsl:attribute>
</xsl:element>
<xsl:if test="//keyword">
<xsl:element name="rx:meta-field">
<xsl:attribute name="name">keywords</xsl:attribute>
<xsl:attribute name="value">
<xsl:for-each select="//keyword">
<xsl:value-of select="normalize-space(.)"/>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:attribute>
</xsl:element>
</xsl:if>
<xsl:if test="//subjectterm">
<xsl:element name="rx:meta-field">
<xsl:attribute name="name">subject</xsl:attribute>
<xsl:attribute name="value">
<xsl:for-each select="//subjectterm">
<xsl:value-of select="normalize-space(.)"/>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:attribute>
</xsl:element>
</xsl:if>
</rx:meta-info>
</xsl:template>
<!-- ********************************************************************
Pdf bookmarks
******************************************************************** -->
<xsl:template match="*" mode="xep.outline">
<xsl:apply-templates select="*" mode="xep.outline"/>
</xsl:template>
<xsl:template match="set|book|part|reference|preface|chapter|appendix|article
|glossary|bibliography|index|setindex
|refentry|refsynopsisdiv
|refsect1|refsect2|refsect3|refsection
|sect1|sect2|sect3|sect4|sect5|section"
mode="xep.outline">
<xsl:variable name="id">
<xsl:call-template name="object.id"/>
</xsl:variable>
<xsl:variable name="bookmark-label">
<xsl:apply-templates select="." mode="object.title.markup"/>
</xsl:variable>
<!-- Put the root element bookmark at the same level as its children -->
<!-- If the object is a set or book, generate a bookmark for the toc -->
<xsl:choose>
<xsl:when test="parent::*">
<rx:bookmark internal-destination="{$id}">
<rx:bookmark-label>
<xsl:value-of select="normalize-space($bookmark-label)"/>
</rx:bookmark-label>
<xsl:apply-templates select="*" mode="xep.outline"/>
</rx:bookmark>
</xsl:when>
<xsl:otherwise>
<xsl:if test="$bookmark-label != ''">
<rx:bookmark internal-destination="{$id}">
<rx:bookmark-label>
<xsl:value-of select="normalize-space($bookmark-label)"/>
</rx:bookmark-label>
</rx:bookmark>
</xsl:if>
<xsl:variable name="toc.params">
<xsl:call-template name="find.path.params">
<xsl:with-param name="table" select="normalize-space($generate.toc)"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="contains($toc.params, 'toc')
and set|book|part|reference|section|sect1|refentry
|article|bibliography|glossary|chapter
|appendix">
<rx:bookmark internal-destination="toc...{$id}">
<rx:bookmark-label>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'TableofContents'"/>
</xsl:call-template>
</rx:bookmark-label>
</rx:bookmark>
</xsl:if>
<xsl:apply-templates select="*" mode="xep.outline"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="xep-pis">
<xsl:if test="$crop.marks != 0">
<xsl:processing-instruction name="xep-pdf-crop-mark-width"><xsl:value-of select="$crop.mark.width"/></xsl:processing-instruction>
<xsl:processing-instruction name="xep-pdf-crop-offset"><xsl:value-of select="$crop.mark.offset"/></xsl:processing-instruction>
<xsl:processing-instruction name="xep-pdf-bleed"><xsl:value-of select="$crop.mark.bleed"/></xsl:processing-instruction>
</xsl:if>
<xsl:call-template name="user-xep-pis"/>
</xsl:template>
<!-- Placeholder for user defined PIs -->
<xsl:template name="user-xep-pis"/>
</xsl:stylesheet>
|