1 <?xml version="1.0" encoding="US-ASCII"?><!--This file was created automatically by xsl2profile--><!--from the DocBook XSL stylesheets.--><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:d="http://docbook.org/ns/docbook" xmlns:exsl="http://exslt.org/common" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:ng="http://docbook.org/docbook-ng" xmlns:db="http://docbook.org/ns/docbook" xmlns:exslt="http://exslt.org/common" exslt:dummy="dummy" ng:dummy="dummy" db:dummy="dummy" extension-element-prefixes="exslt" exclude-result-prefixes="db ng exsl d exslt" version="1.0">
3 <!-- It is important to use indent="no" here, otherwise verbatim -->
4 <!-- environments get broken by indented tags...at least when the -->
5 <!-- callout extension is used...at least with some processors -->
6 <xsl:output method="xml" indent="no"/>
8 <!-- ********************************************************************
10 This file is part of the XSL DocBook Stylesheet distribution.
11 See ../README or http://cdn.docbook.org/release/xsl/current/ for
12 copyright and other information.
14 ******************************************************************** -->
16 <!-- ==================================================================== -->
19 <xsl:include href="../VERSION.xsl"/>
20 <xsl:include href="param.xsl"/>
21 <xsl:include href="../lib/lib.xsl"/>
22 <xsl:include href="../common/l10n.xsl"/>
23 <xsl:include href="../common/common.xsl"/>
24 <xsl:include href="../common/utility.xsl"/>
25 <xsl:include href="../common/labels.xsl"/>
26 <xsl:include href="../common/titles.xsl"/>
27 <xsl:include href="../common/subtitles.xsl"/>
28 <xsl:include href="../common/gentext.xsl"/>
29 <xsl:include href="../common/olink.xsl"/>
30 <xsl:include href="../common/targets.xsl"/>
31 <xsl:include href="../common/pi.xsl"/>
32 <xsl:include href="autotoc.xsl"/>
33 <xsl:include href="autoidx.xsl"/>
34 <xsl:include href="lists.xsl"/>
35 <xsl:include href="callout.xsl"/>
36 <xsl:include href="verbatim.xsl"/>
37 <xsl:include href="graphics.xsl"/>
38 <xsl:include href="xref.xsl"/>
39 <xsl:include href="formal.xsl"/>
40 <xsl:include href="table.xsl"/>
41 <xsl:include href="htmltbl.xsl"/>
42 <xsl:include href="sections.xsl"/>
43 <xsl:include href="inline.xsl"/>
44 <xsl:include href="footnote.xsl"/>
45 <xsl:include href="fo.xsl"/>
46 <xsl:include href="fo-rtf.xsl"/>
47 <xsl:include href="info.xsl"/>
48 <xsl:include href="keywords.xsl"/>
49 <xsl:include href="division.xsl"/>
50 <xsl:include href="index.xsl"/>
51 <xsl:include href="toc.xsl"/>
52 <xsl:include href="refentry.xsl"/>
53 <xsl:include href="math.xsl"/>
54 <xsl:include href="admon.xsl"/>
55 <xsl:include href="component.xsl"/>
56 <xsl:include href="biblio.xsl"/>
57 <xsl:include href="biblio-iso690.xsl"/>
58 <xsl:include href="glossary.xsl"/>
59 <xsl:include href="block.xsl"/>
60 <xsl:include href="task.xsl"/>
61 <xsl:include href="qandaset.xsl"/>
62 <xsl:include href="synop.xsl"/>
63 <xsl:include href="titlepage.xsl"/>
64 <xsl:include href="titlepage.templates.xsl"/>
65 <xsl:include href="pagesetup.xsl"/>
66 <xsl:include href="pi.xsl"/>
67 <xsl:include href="spaces.xsl"/>
68 <xsl:include href="ebnf.xsl"/>
69 <xsl:include href="../html/chunker.xsl"/>
70 <xsl:include href="annotations.xsl"/>
71 <xsl:include href="publishers.xsl"/>
72 <xsl:include href="../common/addns.xsl"/>
74 <xsl:include href="fop.xsl"/>
75 <xsl:include href="fop1.xsl"/>
76 <xsl:include href="xep.xsl"/>
77 <xsl:include href="axf.xsl"/>
78 <xsl:include href="ptc.xsl"/>
80 <xsl:param name="stylesheet.result.type" select="'fo'"/>
82 <!-- ==================================================================== -->
84 <xsl:key name="id" match="*" use="@id|@xml:id"/>
86 <!-- ==================================================================== -->
88 <xsl:template match="*">
90 <xsl:text>Element </xsl:text>
91 <xsl:value-of select="local-name(.)"/>
92 <xsl:text> in namespace '</xsl:text>
93 <xsl:value-of select="namespace-uri(.)"/>
94 <xsl:text>' encountered</xsl:text>
95 <xsl:if test="parent::*">
96 <xsl:text> in </xsl:text>
97 <xsl:value-of select="name(parent::*)"/>
99 <xsl:text>, but no template matches.</xsl:text>
102 <fo:block color="red">
103 <xsl:text><</xsl:text>
104 <xsl:value-of select="name(.)"/>
105 <xsl:text>></xsl:text>
106 <xsl:apply-templates/>
107 <xsl:text></</xsl:text>
108 <xsl:value-of select="name(.)"/>
109 <xsl:text>></xsl:text>
113 <!-- Update this list if new root elements supported -->
114 <xsl:variable name="root.elements" select="' appendix article bibliography book chapter colophon dedication glossary index part preface qandaset refentry reference sect1 section set setindex '"/>
116 <xslo:include xmlns:xslo="http://www.w3.org/1999/XSL/Transform" href="../profiling/profile-mode.xsl"/><xslo:variable xmlns:xslo="http://www.w3.org/1999/XSL/Transform" name="profiled-content"><xslo:choose><xslo:when test="$exsl.node.set.available != 0 and namespace-uri(/*) != 'http://docbook.org/ns/docbook'"><xslo:variable name="with.namespace"><xslo:apply-templates select="/*" mode="addNS"/></xslo:variable><xslo:call-template name="log.message"><xslo:with-param name="level">Note</xslo:with-param><xslo:with-param name="source"><xslo:call-template name="get.doc.title"/></xslo:with-param><xslo:with-param name="context-desc"><xslo:text>namesp. add</xslo:text></xslo:with-param><xslo:with-param name="message"><xslo:text>added namespace before processing</xslo:text></xslo:with-param></xslo:call-template><xslo:apply-templates select="exslt:node-set($with.namespace)" mode="profile"/></xslo:when><xslo:otherwise><xslo:apply-templates select="/" mode="profile"/></xslo:otherwise></xslo:choose></xslo:variable><xslo:variable xmlns:xslo="http://www.w3.org/1999/XSL/Transform" name="profiled-nodes" select="exslt:node-set($profiled-content)"/><xsl:template match="/">
117 <!-- * Get a title for current doc so that we let the user -->
118 <!-- * know what document we are processing at this point. -->
119 <xsl:variable name="doc.title">
120 <xsl:call-template name="get.doc.title"/>
123 <!-- fix namespace if necessary -->
124 <xsl:when test="false()"/>
125 <!-- Can't process unless namespace fixed with exsl node-set()-->
126 <xsl:when test="false()"/>
129 <xsl:when test="$rootid != ''">
130 <xsl:variable name="root.element" select="key('id', $rootid)"/>
132 <xsl:when test="count($root.element) = 0">
133 <xsl:message terminate="yes">
134 <xsl:text>ID '</xsl:text>
135 <xsl:value-of select="$rootid"/>
136 <xsl:text>' not found in document.</xsl:text>
139 <xsl:when test="not(contains($root.elements, concat(' ', local-name($root.element), ' ')))">
140 <xsl:message terminate="yes">
141 <xsl:text>ERROR: Document root element ($rootid=</xsl:text>
142 <xsl:value-of select="$rootid"/>
143 <xsl:text>) for FO output </xsl:text>
144 <xsl:text>must be one of the following elements:</xsl:text>
145 <xsl:value-of select="$root.elements"/>
148 <!-- Otherwise proceed -->
150 <xsl:if test="$collect.xref.targets = 'yes' or $collect.xref.targets = 'only'">
151 <xsl:apply-templates select="$root.element" mode="collect.targets"/>
153 <xsl:if test="$collect.xref.targets != 'only'">
154 <xsl:apply-templates select="$root.element" mode="process.root"/>
159 <!-- Otherwise process the document root element -->
161 <xsl:variable name="document.element" select="*[1]"/>
163 <xsl:when test="not(contains($root.elements, concat(' ', local-name($document.element), ' ')))">
164 <xsl:message terminate="yes">
165 <xsl:text>ERROR: Document root element for FO output </xsl:text>
166 <xsl:text>must be one of the following elements:</xsl:text>
167 <xsl:value-of select="$root.elements"/>
170 <!-- Otherwise proceed -->
172 <xsl:if test="$collect.xref.targets = 'yes' or $collect.xref.targets = 'only'">
173 <xsl:apply-templates select="$profiled-nodes" mode="collect.targets"/>
175 <xsl:if test="$collect.xref.targets != 'only'">
176 <xsl:apply-templates select="$profiled-nodes" mode="process.root"/>
186 <xsl:template match="*" mode="process.root">
187 <xsl:variable name="document.element" select="self::*"/>
189 <xsl:call-template name="root.messages"/>
191 <xsl:variable name="title">
193 <xsl:when test="$document.element/d:title | $document.element/d:info/d:title">
194 <xsl:value-of select="($document.element/d:title | $document.element/d:info/d:title)[1]"/>
196 <xsl:otherwise>[could not find document title]</xsl:otherwise>
200 <!-- Include all id values in XEP output -->
201 <xsl:if test="$xep.extensions != 0">
202 <xsl:processing-instruction name="xep-pdf-drop-unused-destinations">false</xsl:processing-instruction>
205 <fo:root xsl:use-attribute-sets="root.properties">
206 <xsl:attribute name="language">
207 <xsl:call-template name="l10n.language">
208 <xsl:with-param name="target" select="/*[1]"/>
212 <xsl:if test="$xep.extensions != 0">
213 <xsl:call-template name="xep-pis"/>
214 <xsl:call-template name="xep-document-information"/>
216 <xsl:if test="$axf.extensions != 0">
217 <xsl:call-template name="axf-document-information"/>
220 <xsl:call-template name="setup.pagemasters"/>
222 <xsl:if test="$fop1.extensions != 0">
223 <xsl:call-template name="fop1-document-information"/>
224 <xsl:apply-templates select="$document.element" mode="fop1.foxdest"/>
227 <!-- generate bookmark tree -->
228 <xsl:call-template name="generate.bookmarks"/>
230 <xsl:apply-templates select="$document.element"/>
234 <xsl:template name="generate.bookmarks">
235 <xsl:variable name="document.element" select="self::*"/>
237 <xsl:when test="$show.bookmarks = 0">
238 <!-- omit bookmarks -->
240 <xsl:when test="$xsl1.1.bookmarks != 0">
241 <!-- use standard bookmark elements -->
242 <xsl:variable name="bookmarks">
243 <xsl:apply-templates select="$document.element" mode="bookmark"/>
245 <xsl:if test="string($bookmarks) != ''">
247 <xsl:copy-of select="$bookmarks"/>
254 <xsl:when test="$fop.extensions != 0">
255 <xsl:apply-templates select="$document.element" mode="fop.outline"/>
259 <xsl:when test="$fop1.extensions != 0">
260 <xsl:variable name="bookmarks">
261 <xsl:apply-templates select="$document.element" mode="fop1.outline"/>
263 <xsl:if test="string($bookmarks) != ''">
265 <xsl:copy-of select="$bookmarks"/>
270 <!-- RenderX XEP 4.6 and earlier -->
271 <xsl:when test="$xep.extensions != 0">
272 <xsl:variable name="bookmarks">
273 <xsl:apply-templates select="$document.element" mode="xep.outline"/>
275 <xsl:if test="string($bookmarks) != ''">
276 <rx:outline xmlns:rx="http://www.renderx.com/XSL/Extensions">
277 <xsl:copy-of select="$bookmarks"/>
282 <!-- PTC Arbortext -->
283 <xsl:when test="$arbortext.extensions != 0">
284 <xsl:variable name="bookmarks">
285 <xsl:apply-templates select="$document.element" mode="ati.xsl11.bookmarks"/>
287 <xsl:if test="string($bookmarks) != ''">
289 <xsl:copy-of select="$bookmarks"/>
298 <xsl:variable name="bookmarks.state">
300 <xsl:when test="$bookmarks.collapse != 0">hide</xsl:when>
301 <xsl:otherwise>show</xsl:otherwise>
305 <xsl:template match="*" mode="bookmark">
306 <xsl:apply-templates select="*" mode="bookmark"/>
309 <xsl:template match="d:set|d:book|d:part|d:reference| d:preface|d:chapter|d:appendix|d:article|d:topic |d:glossary|d:bibliography|d:index|d:setindex |d:refentry |d:sect1|d:sect2|d:sect3|d:sect4|d:sect5|d:section" mode="bookmark">
311 <xsl:variable name="id">
312 <xsl:call-template name="object.id"/>
314 <xsl:variable name="bookmark-label">
315 <xsl:apply-templates select="." mode="object.title.markup"/>
318 <!-- Put the root element bookmark at the same level as its children -->
319 <!-- If the object is a set or book, generate a bookmark for the toc -->
322 <xsl:when test="self::d:index and $generate.index = 0"/>
323 <xsl:when test="parent::*">
324 <fo:bookmark internal-destination="{$id}">
325 <xsl:attribute name="starting-state">
326 <xsl:value-of select="$bookmarks.state"/>
329 <xsl:value-of select="normalize-space($bookmark-label)"/>
331 <xsl:apply-templates select="*" mode="bookmark"/>
335 <fo:bookmark internal-destination="{$id}">
336 <xsl:attribute name="starting-state">
337 <xsl:value-of select="$bookmarks.state"/>
340 <xsl:value-of select="normalize-space($bookmark-label)"/>
344 <xsl:variable name="toc.params">
345 <xsl:call-template name="find.path.params">
346 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
350 <xsl:if test="contains($toc.params, 'toc') and (d:book|d:part|d:reference|d:preface|d:chapter|d:appendix|d:article|d:topic |d:glossary|d:bibliography|d:index|d:setindex |d:refentry |d:sect1|d:sect2|d:sect3|d:sect4|d:sect5|d:section)">
351 <fo:bookmark internal-destination="toc...{$id}">
353 <xsl:call-template name="gentext">
354 <xsl:with-param name="key" select="'TableofContents'"/>
359 <xsl:apply-templates select="*" mode="bookmark"/>
364 <xsl:template name="root.messages">
365 <!-- redefine this any way you'd like to output messages -->
366 <!-- DO NOT OUTPUT ANYTHING FROM THIS TEMPLATE -->
368 <xsl:text>Making </xsl:text>
369 <xsl:value-of select="$page.orientation"/>
370 <xsl:text> pages on </xsl:text>
371 <xsl:value-of select="$paper.type"/>
372 <xsl:text> paper (</xsl:text>
373 <xsl:value-of select="$page.width"/>
374 <xsl:text>x</xsl:text>
375 <xsl:value-of select="$page.height"/>
376 <xsl:text>)</xsl:text>
380 <!-- ==================================================================== -->