include more low-level bindings
[clinton/guile-figl.git] / upstream-man-pages / man3 / pdf / opengl-pdf.xsl
1 <?xml version='1.0'?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:exsl="http://exslt.org/common"
4 xmlns:fo="http://www.w3.org/1999/XSL/Format"
5 xmlns:ng="http://docbook.org/docbook-ng"
6 xmlns:db="http://docbook.org/ns/docbook"
7 exclude-result-prefixes="db ng exsl"
8 version='1.0'>
9
10 <!-- It is important to use indent="no" here, otherwise verbatim -->
11 <!-- environments get broken by indented tags...at least when the -->
12 <!-- callout extension is used...at least with some processors -->
13 <xsl:output method="xml" indent="no"/>
14
15 <!-- ********************************************************************
16 $Id: docbook.xsl 6910 2007-06-28 23:23:30Z xmldoc $
17 ********************************************************************
18
19 This file is part of the XSL DocBook Stylesheet distribution.
20 See ../README or http://docbook.sf.net/release/xsl/current/ for
21 copyright and other information.
22
23 ******************************************************************** -->
24
25 <!-- ==================================================================== -->
26
27 <xsl:include href="../VERSION"/>
28 <xsl:include href="param.xsl"/>
29 <xsl:include href="../lib/lib.xsl"/>
30 <xsl:include href="../common/l10n.xsl"/>
31 <xsl:include href="../common/common.xsl"/>
32 <xsl:include href="../common/utility.xsl"/>
33 <xsl:include href="../common/labels.xsl"/>
34 <xsl:include href="../common/titles.xsl"/>
35 <xsl:include href="../common/subtitles.xsl"/>
36 <xsl:include href="../common/gentext.xsl"/>
37 <xsl:include href="../common/olink.xsl"/>
38 <xsl:include href="../common/targets.xsl"/>
39 <xsl:include href="../common/pi.xsl"/>
40 <xsl:include href="autotoc.xsl"/>
41 <xsl:include href="autoidx.xsl"/>
42 <xsl:include href="lists.xsl"/>
43 <xsl:include href="callout.xsl"/>
44 <xsl:include href="verbatim.xsl"/>
45 <xsl:include href="graphics.xsl"/>
46 <xsl:include href="xref.xsl"/>
47 <xsl:include href="formal.xsl"/>
48 <xsl:include href="table.xsl"/>
49 <xsl:include href="htmltbl.xsl"/>
50 <xsl:include href="sections.xsl"/>
51 <xsl:include href="inline.xsl"/>
52 <xsl:include href="footnote.xsl"/>
53 <xsl:include href="fo.xsl"/>
54 <xsl:include href="fo-rtf.xsl"/>
55 <xsl:include href="info.xsl"/>
56 <xsl:include href="keywords.xsl"/>
57 <xsl:include href="division.xsl"/>
58 <xsl:include href="index.xsl"/>
59 <xsl:include href="toc.xsl"/>
60 <xsl:include href="refentry.xsl"/>
61 <xsl:include href="math.xsl"/>
62 <xsl:include href="admon.xsl"/>
63 <xsl:include href="component.xsl"/>
64 <xsl:include href="biblio.xsl"/>
65 <xsl:include href="biblio-iso690.xsl"/>
66 <xsl:include href="glossary.xsl"/>
67 <xsl:include href="block.xsl"/>
68 <xsl:include href="task.xsl"/>
69 <xsl:include href="qandaset.xsl"/>
70 <xsl:include href="synop.xsl"/>
71 <xsl:include href="titlepage.xsl"/>
72 <xsl:include href="titlepage.templates.xsl"/>
73 <xsl:include href="pagesetup.xsl"/>
74 <xsl:include href="pi.xsl"/>
75 <xsl:include href="spaces.xsl"/>
76 <xsl:include href="ebnf.xsl"/>
77 <xsl:include href="../html/chunker.xsl"/>
78 <xsl:include href="annotations.xsl"/>
79 <xsl:include href="../common/stripns.xsl"/>
80
81 <xsl:include href="fop.xsl"/>
82 <xsl:include href="fop1.xsl"/>
83 <xsl:include href="passivetex.xsl"/>
84 <xsl:include href="xep.xsl"/>
85 <xsl:include href="axf.xsl"/>
86 <xsl:include href="ptc.xsl"/>
87
88 <xsl:param name="stylesheet.result.type" select="'fo'"/>
89
90
91 <!-- BEI -->
92 <xsl:param name="symbol.font.family">Symbol,ZapfDingbats,Lucida Sans Unicode</xsl:param>
93 <xsl:param name="funcsynopsis.style">ansi</xsl:param>
94 <xsl:param name="citerefentry.link" select="1"></xsl:param>
95
96 <xsl:template match="symbol[@role = 'symbolfont']">
97 <fo:inline font-family="Symbol,ZapfDingbats,Lucida Sans Unicode">
98 <xsl:apply-templates/>
99 </fo:inline>
100 </xsl:template>
101
102
103
104
105 <!-- ==================================================================== -->
106
107 <xsl:key name="id" match="*" use="@id|@xml:id"/>
108
109 <!-- ==================================================================== -->
110
111 <xsl:template match="*">
112 <xsl:message>
113 <xsl:value-of select="name(.)"/>
114 <xsl:text> encountered</xsl:text>
115 <xsl:if test="parent::*">
116 <xsl:text> in </xsl:text>
117 <xsl:value-of select="name(parent::*)"/>
118 </xsl:if>
119 <xsl:text>, but no template matches.</xsl:text>
120 </xsl:message>
121 <fo:block color="red">
122 <xsl:text>&lt;</xsl:text>
123 <xsl:value-of select="name(.)"/>
124 <xsl:text>&gt;</xsl:text>
125 <xsl:apply-templates/>
126 <xsl:text>&lt;/</xsl:text>
127 <xsl:value-of select="name(.)"/>
128 <xsl:text>&gt;</xsl:text>
129 </fo:block>
130 </xsl:template>
131
132 <!-- Update this list if new root elements supported -->
133 <xsl:variable name="root.elements" select="' appendix article bibliography book chapter colophon dedication glossary index part preface qandaset refentry reference sect1 section set setindex '"/>
134
135
136
137
138 <xsl:template match="/">
139 <!-- * Get a title for current doc so that we let the user -->
140 <!-- * know what document we are processing at this point. -->
141 <xsl:variable name="doc.title">
142 <xsl:call-template name="get.doc.title"/>
143 </xsl:variable>
144 <xsl:choose>
145 <!-- Hack! If someone hands us a DocBook V5.x or DocBook NG document,
146 toss the namespace and continue. Use the docbook5 namespaced
147 stylesheets for DocBook5 if you don't want to use this feature.-->
148 <!-- include extra test for Xalan quirk -->
149 <xsl:when test="(function-available('exsl:node-set') or
150 contains(system-property('xsl:vendor'),
151 'Apache Software Foundation'))
152 and (*/self::ng:* or */self::db:*)">
153 <xsl:call-template name="log.message">
154 <xsl:with-param name="level">Note</xsl:with-param>
155 <xsl:with-param name="source" select="$doc.title"/>
156 <xsl:with-param name="context-desc">
157 <xsl:text>namesp. cut</xsl:text>
158 </xsl:with-param>
159 <xsl:with-param name="message">
160 <xsl:text>stripped namespace before processing</xsl:text>
161 </xsl:with-param>
162 </xsl:call-template>
163 <xsl:variable name="nons">
164 <xsl:apply-templates mode="stripNS"/>
165 </xsl:variable>
166 <xsl:call-template name="log.message">
167 <xsl:with-param name="level">Note</xsl:with-param>
168 <xsl:with-param name="source" select="$doc.title"/>
169 <xsl:with-param name="context-desc">
170 <xsl:text>namesp. cut</xsl:text>
171 </xsl:with-param>
172 <xsl:with-param name="message">
173 <xsl:text>processing stripped document</xsl:text>
174 </xsl:with-param>
175 </xsl:call-template>
176 <xsl:apply-templates select="exsl:node-set($nons)"/>
177 </xsl:when>
178 <!-- Can't process unless namespace removed -->
179 <xsl:when test="*/self::ng:* or */self::db:*">
180 <xsl:message terminate="yes">
181 <xsl:text>Unable to strip the namespace from DB5 document,</xsl:text>
182 <xsl:text> cannot proceed.</xsl:text>
183 </xsl:message>
184 </xsl:when>
185 <xsl:otherwise>
186 <xsl:choose>
187 <xsl:when test="$rootid != ''">
188 <xsl:variable name="root.element" select="key('id', $rootid)"/>
189 <xsl:choose>
190 <xsl:when test="count($root.element) = 0">
191 <xsl:message terminate="yes">
192 <xsl:text>ID '</xsl:text>
193 <xsl:value-of select="$rootid"/>
194 <xsl:text>' not found in document.</xsl:text>
195 </xsl:message>
196 </xsl:when>
197 <xsl:when test="not(contains($root.elements, concat(' ', local-name($root.element), ' ')))">
198 <xsl:message terminate="yes">
199 <xsl:text>ERROR: Document root element ($rootid=</xsl:text>
200 <xsl:value-of select="$rootid"/>
201 <xsl:text>) for FO output </xsl:text>
202 <xsl:text>must be one of the following elements:</xsl:text>
203 <xsl:value-of select="$root.elements"/>
204 </xsl:message>
205 </xsl:when>
206 <!-- Otherwise proceed -->
207 <xsl:otherwise>
208 <xsl:if test="$collect.xref.targets = 'yes' or
209 $collect.xref.targets = 'only'">
210 <xsl:apply-templates select="$root.element"
211 mode="collect.targets"/>
212 </xsl:if>
213 <xsl:if test="$collect.xref.targets != 'only'">
214 <xsl:apply-templates select="$root.element"
215 mode="process.root"/>
216 </xsl:if>
217 </xsl:otherwise>
218 </xsl:choose>
219 </xsl:when>
220 <!-- Otherwise process the document root element -->
221 <xsl:otherwise>
222 <xsl:variable name="document.element" select="*[1]"/>
223 <xsl:choose>
224 <xsl:when test="not(contains($root.elements,
225 concat(' ', local-name($document.element), ' ')))">
226 <xsl:message terminate="yes">
227 <xsl:text>ERROR: Document root element for FO output </xsl:text>
228 <xsl:text>must be one of the following elements:</xsl:text>
229 <xsl:value-of select="$root.elements"/>
230 </xsl:message>
231 </xsl:when>
232 <!-- Otherwise proceed -->
233 <xsl:otherwise>
234 <xsl:if test="$collect.xref.targets = 'yes' or
235 $collect.xref.targets = 'only'">
236 <xsl:apply-templates select="/"
237 mode="collect.targets"/>
238 </xsl:if>
239 <xsl:if test="$collect.xref.targets != 'only'">
240 <xsl:apply-templates select="/"
241 mode="process.root"/>
242 </xsl:if>
243 </xsl:otherwise>
244 </xsl:choose>
245 </xsl:otherwise>
246 </xsl:choose>
247 </xsl:otherwise>
248 </xsl:choose>
249 </xsl:template>
250
251 <xsl:template match="*" mode="process.root">
252 <xsl:variable name="document.element" select="self::*"/>
253
254 <xsl:call-template name="root.messages"/>
255
256 <xsl:variable name="title">
257 <xsl:choose>
258 <xsl:when test="$document.element/title[1]">
259 <xsl:value-of select="$document.element/title[1]"/>
260 </xsl:when>
261 <xsl:otherwise>[could not find document title]</xsl:otherwise>
262 </xsl:choose>
263 </xsl:variable>
264
265 <!-- Include all id values in XEP output -->
266 <xsl:if test="$xep.extensions != 0">
267 <xsl:processing-instruction
268 name="xep-pdf-drop-unused-destinations">false</xsl:processing-instruction>
269 </xsl:if>
270
271 <fo:root xsl:use-attribute-sets="root.properties">
272 <xsl:attribute name="language">
273 <xsl:call-template name="l10n.language">
274 <xsl:with-param name="target" select="/*[1]"/>
275 </xsl:call-template>
276 </xsl:attribute>
277
278 <xsl:if test="$xep.extensions != 0">
279 <xsl:call-template name="xep-pis"/>
280 <xsl:call-template name="xep-document-information"/>
281 </xsl:if>
282 <xsl:if test="$axf.extensions != 0">
283 <xsl:call-template name="axf-document-information"/>
284 </xsl:if>
285
286 <xsl:call-template name="setup.pagemasters"/>
287
288 <xsl:if test="$fop.extensions != 0">
289 <xsl:apply-templates select="$document.element" mode="fop.outline"/>
290 </xsl:if>
291
292 <xsl:if test="$fop1.extensions != 0">
293 <xsl:variable name="bookmarks">
294 <xsl:apply-templates select="$document.element"
295 mode="fop1.outline"/>
296 </xsl:variable>
297 <xsl:if test="string($bookmarks) != ''">
298 <fo:bookmark-tree>
299 <xsl:copy-of select="$bookmarks"/>
300 </fo:bookmark-tree>
301 </xsl:if>
302 </xsl:if>
303
304 <xsl:if test="$xep.extensions != 0">
305 <xsl:variable name="bookmarks">
306 <xsl:apply-templates select="$document.element" mode="xep.outline"/>
307 </xsl:variable>
308 <xsl:if test="string($bookmarks) != ''">
309 <rx:outline xmlns:rx="http://www.renderx.com/XSL/Extensions">
310 <xsl:copy-of select="$bookmarks"/>
311 </rx:outline>
312 </xsl:if>
313 </xsl:if>
314
315 <xsl:if test="$arbortext.extensions != 0 and $ati.xsl11.bookmarks != 0">
316 <xsl:variable name="bookmarks">
317 <xsl:apply-templates select="$document.element"
318 mode="ati.xsl11.bookmarks"/>
319 </xsl:variable>
320 <xsl:if test="string($bookmarks) != ''">
321 <fo:bookmark-tree>
322 <xsl:copy-of select="$bookmarks"/>
323 </fo:bookmark-tree>
324 </xsl:if>
325 </xsl:if>
326
327 <xsl:apply-templates select="$document.element"/>
328 </fo:root>
329 </xsl:template>
330
331 <xsl:template name="root.messages">
332 <!-- redefine this any way you'd like to output messages -->
333 <!-- DO NOT OUTPUT ANYTHING FROM THIS TEMPLATE -->
334 <xsl:message>
335 <xsl:text>Making </xsl:text>
336 <xsl:value-of select="$page.orientation"/>
337 <xsl:text> pages on </xsl:text>
338 <xsl:value-of select="$paper.type"/>
339 <xsl:text> paper (</xsl:text>
340 <xsl:value-of select="$page.width"/>
341 <xsl:text>x</xsl:text>
342 <xsl:value-of select="$page.height"/>
343 <xsl:text>)</xsl:text>
344 </xsl:message>
345 </xsl:template>
346
347 <!-- ==================================================================== -->
348
349 </xsl:stylesheet>