]> git.evergreen-ils.org Git - working/Evergreen.git/blob - stylesheets/evergreen_docbook_files/docbook-xsl-1.75.2/fo/profile-docbook.xsl
Add stylesheets for our evergreen docbook site.
[working/Evergreen.git] / stylesheets / evergreen_docbook_files / docbook-xsl-1.75.2 / fo / profile-docbook.xsl
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: docbook.xsl 8414 2009-04-18 22:40:23Z bobstayton $
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:text>Element </xsl:text>
95     <xsl:value-of select="local-name(.)"/>
96     <xsl:text> in namespace '</xsl:text>
97     <xsl:value-of select="namespace-uri(.)"/>
98     <xsl:text>' encountered</xsl:text>
99     <xsl:if test="parent::*">
100       <xsl:text> in </xsl:text>
101       <xsl:value-of select="name(parent::*)"/>
102     </xsl:if>
103     <xsl:text>, but no template matches.</xsl:text>
104   </xsl:message>
105   
106   <fo:block color="red">
107     <xsl:text>&lt;</xsl:text>
108     <xsl:value-of select="name(.)"/>
109     <xsl:text>&gt;</xsl:text>
110     <xsl:apply-templates/> 
111     <xsl:text>&lt;/</xsl:text>
112     <xsl:value-of select="name(.)"/>
113     <xsl:text>&gt;</xsl:text>
114   </fo:block>
115 </xsl:template>
116
117 <!-- Update this list if new root elements supported -->
118 <xsl:variable name="root.elements" select="' appendix article bibliography book chapter colophon dedication glossary index part preface qandaset refentry reference sect1 section set setindex '"/>
119
120 <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="/">
121   <!-- * Get a title for current doc so that we let the user -->
122   <!-- * know what document we are processing at this point. -->
123   <xsl:variable name="doc.title">
124     <xsl:call-template name="get.doc.title"/>
125   </xsl:variable>
126   <xsl:choose>
127     <!-- Hack! If someone hands us a DocBook V5.x or DocBook NG document,
128          toss the namespace and continue.  Use the docbook5 namespaced
129          stylesheets for DocBook5 if you don't want to use this feature.-->
130     <xsl:when test="false()"/>
131     <!-- Can't process unless namespace removed -->
132     <xsl:when test="false()"/>
133     <xsl:otherwise>
134       <xsl:choose>
135         <xsl:when test="$rootid != ''">
136           <xsl:variable name="root.element" select="key('id', $rootid)"/>
137           <xsl:choose>
138             <xsl:when test="count($root.element) = 0">
139               <xsl:message terminate="yes">
140                 <xsl:text>ID '</xsl:text>
141                 <xsl:value-of select="$rootid"/>
142                 <xsl:text>' not found in document.</xsl:text>
143               </xsl:message>
144             </xsl:when>
145             <xsl:when test="not(contains($root.elements, concat(' ', local-name($root.element), ' ')))">
146               <xsl:message terminate="yes">
147                 <xsl:text>ERROR: Document root element ($rootid=</xsl:text>
148                 <xsl:value-of select="$rootid"/>
149                 <xsl:text>) for FO output </xsl:text>
150                 <xsl:text>must be one of the following elements:</xsl:text>
151                 <xsl:value-of select="$root.elements"/>
152               </xsl:message>
153             </xsl:when>
154             <!-- Otherwise proceed -->
155             <xsl:otherwise>
156               <xsl:if test="$collect.xref.targets = 'yes' or                             $collect.xref.targets = 'only'">
157                 <xsl:apply-templates select="$root.element" mode="collect.targets"/>
158               </xsl:if>
159               <xsl:if test="$collect.xref.targets != 'only'">
160                 <xsl:apply-templates select="$root.element" mode="process.root"/>
161               </xsl:if>
162             </xsl:otherwise>
163           </xsl:choose>
164         </xsl:when>
165         <!-- Otherwise process the document root element -->
166         <xsl:otherwise>
167           <xsl:variable name="document.element" select="*[1]"/>
168           <xsl:choose>
169             <xsl:when test="not(contains($root.elements,                      concat(' ', local-name($document.element), ' ')))">
170               <xsl:message terminate="yes">
171                 <xsl:text>ERROR: Document root element for FO output </xsl:text>
172                 <xsl:text>must be one of the following elements:</xsl:text>
173                 <xsl:value-of select="$root.elements"/>
174               </xsl:message>
175             </xsl:when>
176             <!-- Otherwise proceed -->
177             <xsl:otherwise>
178               <xsl:if test="$collect.xref.targets = 'yes' or                             $collect.xref.targets = 'only'">
179                 <xsl:apply-templates select="$profiled-nodes" mode="collect.targets"/>
180               </xsl:if>
181               <xsl:if test="$collect.xref.targets != 'only'">
182                 <xsl:apply-templates select="$profiled-nodes" mode="process.root"/>
183               </xsl:if>
184             </xsl:otherwise>
185           </xsl:choose>
186         </xsl:otherwise>
187       </xsl:choose>
188     </xsl:otherwise>
189   </xsl:choose>
190 </xsl:template>
191
192 <xsl:template match="*" mode="process.root">
193   <xsl:variable name="document.element" select="self::*"/>
194
195   <xsl:call-template name="root.messages"/>
196
197   <xsl:variable name="title">
198     <xsl:choose>
199       <xsl:when test="$document.element/title[1]">
200         <xsl:value-of select="$document.element/title[1]"/>
201       </xsl:when>
202       <xsl:otherwise>[could not find document title]</xsl:otherwise>
203     </xsl:choose>
204   </xsl:variable>
205   
206   <!-- Include all id values in XEP output -->
207   <xsl:if test="$xep.extensions != 0">
208     <xsl:processing-instruction name="xep-pdf-drop-unused-destinations">false</xsl:processing-instruction>
209   </xsl:if>
210
211   <fo:root xsl:use-attribute-sets="root.properties">
212     <xsl:attribute name="language">
213       <xsl:call-template name="l10n.language">
214         <xsl:with-param name="target" select="/*[1]"/>
215       </xsl:call-template>
216     </xsl:attribute>
217
218     <xsl:if test="$xep.extensions != 0">
219       <xsl:call-template name="xep-pis"/>
220       <xsl:call-template name="xep-document-information"/>
221     </xsl:if>
222     <xsl:if test="$axf.extensions != 0">
223       <xsl:call-template name="axf-document-information"/>
224     </xsl:if>
225
226     <xsl:call-template name="setup.pagemasters"/>
227
228     <xsl:if test="$fop.extensions != 0">
229       <xsl:apply-templates select="$document.element" mode="fop.outline"/>
230     </xsl:if>
231
232     <xsl:if test="$fop1.extensions != 0">
233       <xsl:call-template name="fop1-document-information"/>
234       <xsl:variable name="bookmarks">
235         <xsl:apply-templates select="$document.element" mode="fop1.outline"/>
236       </xsl:variable>
237       <xsl:if test="string($bookmarks) != ''">
238         <fo:bookmark-tree>
239           <xsl:copy-of select="$bookmarks"/>
240         </fo:bookmark-tree>
241       </xsl:if>
242     </xsl:if>
243
244     <xsl:if test="$xep.extensions != 0">
245       <xsl:variable name="bookmarks">
246         <xsl:apply-templates select="$document.element" mode="xep.outline"/>
247       </xsl:variable>
248       <xsl:if test="string($bookmarks) != ''">
249         <rx:outline xmlns:rx="http://www.renderx.com/XSL/Extensions">
250           <xsl:copy-of select="$bookmarks"/>
251         </rx:outline>
252       </xsl:if>
253     </xsl:if>
254
255     <xsl:if test="$arbortext.extensions != 0 and $ati.xsl11.bookmarks != 0">
256       <xsl:variable name="bookmarks">
257         <xsl:apply-templates select="$document.element" mode="ati.xsl11.bookmarks"/>
258       </xsl:variable>
259       <xsl:if test="string($bookmarks) != ''">
260         <fo:bookmark-tree>
261           <xsl:copy-of select="$bookmarks"/>
262         </fo:bookmark-tree>
263       </xsl:if>
264     </xsl:if>
265
266     <xsl:apply-templates select="$document.element"/>
267   </fo:root>
268 </xsl:template>
269
270 <xsl:template name="root.messages">
271   <!-- redefine this any way you'd like to output messages -->
272   <!-- DO NOT OUTPUT ANYTHING FROM THIS TEMPLATE -->
273   <xsl:message>
274     <xsl:text>Making </xsl:text>
275     <xsl:value-of select="$page.orientation"/>
276     <xsl:text> pages on </xsl:text>
277     <xsl:value-of select="$paper.type"/>
278     <xsl:text> paper (</xsl:text>
279     <xsl:value-of select="$page.width"/>
280     <xsl:text>x</xsl:text>
281     <xsl:value-of select="$page.height"/>
282     <xsl:text>)</xsl:text>
283   </xsl:message>
284 </xsl:template>
285
286 <!-- ==================================================================== -->
287
288 </xsl:stylesheet>