source: BOOK/stylesheets/lfs-xsl/docbook-xsl-snapshot/fo/profile-docbook.xsl@ d1d0c9d

clfs-3.0.0-sysvinit sysvinit
Last change on this file since d1d0c9d was f8c4e94, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Added LFS XSL Stylesheets.

  • Property mode set to 100644
File size: 11.7 KB
Line 
1<?xml version="1.0" encoding="US-ASCII"?>
2<!--This file was created automatically by xsl2profile-->
3<!--from the DocBook XSL stylesheets.-->
4<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 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 exslt" version="1.0">
5
6<!-- It is important to use indent="no" here, otherwise verbatim -->
7<!-- environments get broken by indented tags...at least when the -->
8<!-- callout extension is used...at least with some processors -->
9<xsl:output method="xml" indent="no"/>
10
11<!-- ********************************************************************
12 $Id$
13 ********************************************************************
14
15 This file is part of the XSL DocBook Stylesheet distribution.
16 See ../README or http://docbook.sf.net/release/xsl/current/ for
17 copyright and other information.
18
19 ******************************************************************** -->
20
21<!-- ==================================================================== -->
22
23<xsl:include href="../VERSION"/>
24<xsl:include href="param.xsl"/>
25<xsl:include href="../lib/lib.xsl"/>
26<xsl:include href="../common/l10n.xsl"/>
27<xsl:include href="../common/common.xsl"/>
28<xsl:include href="../common/utility.xsl"/>
29<xsl:include href="../common/labels.xsl"/>
30<xsl:include href="../common/titles.xsl"/>
31<xsl:include href="../common/subtitles.xsl"/>
32<xsl:include href="../common/gentext.xsl"/>
33<xsl:include href="../common/olink.xsl"/>
34<xsl:include href="../common/targets.xsl"/>
35<xsl:include href="../common/pi.xsl"/>
36<xsl:include href="autotoc.xsl"/>
37<xsl:include href="autoidx.xsl"/>
38<xsl:include href="lists.xsl"/>
39<xsl:include href="callout.xsl"/>
40<xsl:include href="verbatim.xsl"/>
41<xsl:include href="graphics.xsl"/>
42<xsl:include href="xref.xsl"/>
43<xsl:include href="formal.xsl"/>
44<xsl:include href="table.xsl"/>
45<xsl:include href="htmltbl.xsl"/>
46<xsl:include href="sections.xsl"/>
47<xsl:include href="inline.xsl"/>
48<xsl:include href="footnote.xsl"/>
49<xsl:include href="fo.xsl"/>
50<xsl:include href="fo-rtf.xsl"/>
51<xsl:include href="info.xsl"/>
52<xsl:include href="keywords.xsl"/>
53<xsl:include href="division.xsl"/>
54<xsl:include href="index.xsl"/>
55<xsl:include href="toc.xsl"/>
56<xsl:include href="refentry.xsl"/>
57<xsl:include href="math.xsl"/>
58<xsl:include href="admon.xsl"/>
59<xsl:include href="component.xsl"/>
60<xsl:include href="biblio.xsl"/>
61<xsl:include href="biblio-iso690.xsl"/>
62<xsl:include href="glossary.xsl"/>
63<xsl:include href="block.xsl"/>
64<xsl:include href="task.xsl"/>
65<xsl:include href="qandaset.xsl"/>
66<xsl:include href="synop.xsl"/>
67<xsl:include href="titlepage.xsl"/>
68<xsl:include href="titlepage.templates.xsl"/>
69<xsl:include href="pagesetup.xsl"/>
70<xsl:include href="pi.xsl"/>
71<xsl:include href="spaces.xsl"/>
72<xsl:include href="ebnf.xsl"/>
73<xsl:include href="../html/chunker.xsl"/>
74<xsl:include href="annotations.xsl"/>
75<xsl:include href="../common/stripns.xsl"/>
76
77<xsl:include href="fop.xsl"/>
78<xsl:include href="fop1.xsl"/>
79<xsl:include href="passivetex.xsl"/>
80<xsl:include href="xep.xsl"/>
81<xsl:include href="axf.xsl"/>
82<xsl:include href="ptc.xsl"/>
83
84<xsl:param name="stylesheet.result.type" select="'fo'"/>
85
86<!-- ==================================================================== -->
87
88<xsl:key name="id" match="*" use="@id|@xml:id"/>
89
90<!-- ==================================================================== -->
91
92<xsl:template match="*">
93 <xsl:message>
94 <xsl:value-of select="name(.)"/>
95 <xsl:text> encountered</xsl:text>
96 <xsl:if test="parent::*">
97 <xsl:text> in </xsl:text>
98 <xsl:value-of select="name(parent::*)"/>
99 </xsl:if>
100 <xsl:text>, but no template matches.</xsl:text>
101 </xsl:message>
102 <fo:block color="red">
103 <xsl:text>&lt;</xsl:text>
104 <xsl:value-of select="name(.)"/>
105 <xsl:text>&gt;</xsl:text>
106 <xsl:apply-templates/>
107 <xsl:text>&lt;/</xsl:text>
108 <xsl:value-of select="name(.)"/>
109 <xsl:text>&gt;</xsl:text>
110 </fo:block>
111</xsl:template>
112
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 '"/>
115
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="*/self::ng:* or */self::db:*"><xslo:message>Note: namesp. cut : stripped namespace before processing</xslo:message><xslo:variable name="stripped-content"><xslo:apply-templates select="/" mode="stripNS"/></xslo:variable><xslo:message>Note: namesp. cut : processing stripped document</xslo:message><xslo:apply-templates select="exslt:node-set($stripped-content)" 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"/>
121 </xsl:variable>
122 <xsl:choose>
123 <!-- Hack! If someone hands us a DocBook V5.x or DocBook NG document,
124 toss the namespace and continue. Use the docbook5 namespaced
125 stylesheets for DocBook5 if you don't want to use this feature.-->
126 <!-- include extra test for Xalan quirk -->
127 <xsl:when test="false()"/>
128 <!-- Can't process unless namespace removed -->
129 <xsl:when test="false()"/>
130 <xsl:otherwise>
131 <xsl:choose>
132 <xsl:when test="$rootid != ''">
133 <xsl:variable name="root.element" select="key('id', $rootid)"/>
134 <xsl:choose>
135 <xsl:when test="count($root.element) = 0">
136 <xsl:message terminate="yes">
137 <xsl:text>ID '</xsl:text>
138 <xsl:value-of select="$rootid"/>
139 <xsl:text>' not found in document.</xsl:text>
140 </xsl:message>
141 </xsl:when>
142 <xsl:when test="not(contains($root.elements, concat(' ', local-name($root.element), ' ')))">
143 <xsl:message terminate="yes">
144 <xsl:text>ERROR: Document root element ($rootid=</xsl:text>
145 <xsl:value-of select="$rootid"/>
146 <xsl:text>) for FO output </xsl:text>
147 <xsl:text>must be one of the following elements:</xsl:text>
148 <xsl:value-of select="$root.elements"/>
149 </xsl:message>
150 </xsl:when>
151 <!-- Otherwise proceed -->
152 <xsl:otherwise>
153 <xsl:if test="$collect.xref.targets = 'yes' or $collect.xref.targets = 'only'">
154 <xsl:apply-templates select="$root.element" mode="collect.targets"/>
155 </xsl:if>
156 <xsl:if test="$collect.xref.targets != 'only'">
157 <xsl:apply-templates select="$root.element" mode="process.root"/>
158 </xsl:if>
159 </xsl:otherwise>
160 </xsl:choose>
161 </xsl:when>
162 <!-- Otherwise process the document root element -->
163 <xsl:otherwise>
164 <xsl:variable name="document.element" select="*[1]"/>
165 <xsl:choose>
166 <xsl:when test="not(contains($root.elements, concat(' ', local-name($document.element), ' ')))">
167 <xsl:message terminate="yes">
168 <xsl:text>ERROR: Document root element for FO output </xsl:text>
169 <xsl:text>must be one of the following elements:</xsl:text>
170 <xsl:value-of select="$root.elements"/>
171 </xsl:message>
172 </xsl:when>
173 <!-- Otherwise proceed -->
174 <xsl:otherwise>
175 <xsl:if test="$collect.xref.targets = 'yes' or $collect.xref.targets = 'only'">
176 <xsl:apply-templates select="$profiled-nodes" mode="collect.targets"/>
177 </xsl:if>
178 <xsl:if test="$collect.xref.targets != 'only'">
179 <xsl:apply-templates select="$profiled-nodes" mode="process.root"/>
180 </xsl:if>
181 </xsl:otherwise>
182 </xsl:choose>
183 </xsl:otherwise>
184 </xsl:choose>
185 </xsl:otherwise>
186 </xsl:choose>
187</xsl:template>
188
189<xsl:template match="*" mode="process.root">
190 <xsl:variable name="document.element" select="self::*"/>
191
192 <xsl:call-template name="root.messages"/>
193
194 <xsl:variable name="title">
195 <xsl:choose>
196 <xsl:when test="$document.element/title[1]">
197 <xsl:value-of select="$document.element/title[1]"/>
198 </xsl:when>
199 <xsl:otherwise>[could not find document title]</xsl:otherwise>
200 </xsl:choose>
201 </xsl:variable>
202
203 <!-- Include all id values in XEP output -->
204 <xsl:if test="$xep.extensions != 0">
205 <xsl:processing-instruction name="xep-pdf-drop-unused-destinations">false</xsl:processing-instruction>
206 </xsl:if>
207
208 <fo:root xsl:use-attribute-sets="root.properties">
209 <xsl:attribute name="language">
210 <xsl:call-template name="l10n.language">
211 <xsl:with-param name="target" select="/*[1]"/>
212 </xsl:call-template>
213 </xsl:attribute>
214
215 <xsl:if test="$xep.extensions != 0">
216 <xsl:call-template name="xep-pis"/>
217 <xsl:call-template name="xep-document-information"/>
218 </xsl:if>
219 <xsl:if test="$axf.extensions != 0">
220 <xsl:call-template name="axf-document-information"/>
221 </xsl:if>
222
223 <xsl:call-template name="setup.pagemasters"/>
224
225 <xsl:if test="$fop.extensions != 0">
226 <xsl:apply-templates select="$document.element" mode="fop.outline"/>
227 </xsl:if>
228
229 <xsl:if test="$fop1.extensions != 0">
230 <xsl:variable name="bookmarks">
231 <xsl:apply-templates select="$document.element" mode="fop1.outline"/>
232 </xsl:variable>
233 <xsl:if test="string($bookmarks) != ''">
234 <fo:bookmark-tree>
235 <xsl:copy-of select="$bookmarks"/>
236 </fo:bookmark-tree>
237 </xsl:if>
238 </xsl:if>
239
240 <xsl:if test="$xep.extensions != 0">
241 <xsl:variable name="bookmarks">
242 <xsl:apply-templates select="$document.element" mode="xep.outline"/>
243 </xsl:variable>
244 <xsl:if test="string($bookmarks) != ''">
245 <rx:outline xmlns:rx="http://www.renderx.com/XSL/Extensions">
246 <xsl:copy-of select="$bookmarks"/>
247 </rx:outline>
248 </xsl:if>
249 </xsl:if>
250
251 <xsl:if test="$arbortext.extensions != 0 and $ati.xsl11.bookmarks != 0">
252 <xsl:variable name="bookmarks">
253 <xsl:apply-templates select="$document.element" mode="ati.xsl11.bookmarks"/>
254 </xsl:variable>
255 <xsl:if test="string($bookmarks) != ''">
256 <fo:bookmark-tree>
257 <xsl:copy-of select="$bookmarks"/>
258 </fo:bookmark-tree>
259 </xsl:if>
260 </xsl:if>
261
262 <xsl:apply-templates select="$document.element"/>
263 </fo:root>
264</xsl:template>
265
266<xsl:template name="root.messages">
267 <!-- redefine this any way you'd like to output messages -->
268 <!-- DO NOT OUTPUT ANYTHING FROM THIS TEMPLATE -->
269 <xsl:message>
270 <xsl:text>Making </xsl:text>
271 <xsl:value-of select="$page.orientation"/>
272 <xsl:text> pages on </xsl:text>
273 <xsl:value-of select="$paper.type"/>
274 <xsl:text> paper (</xsl:text>
275 <xsl:value-of select="$page.width"/>
276 <xsl:text>x</xsl:text>
277 <xsl:value-of select="$page.height"/>
278 <xsl:text>)</xsl:text>
279 </xsl:message>
280</xsl:template>
281
282<!-- ==================================================================== -->
283
284</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.