1<?xml version="1.0" encoding="US-ASCII"?>
2<!--This file was created automatically by xsl2profile-->
3<!--from the DocBook XSL stylesheets. Do not edit this file.-->
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,v 1.41 2006/05/07 07:19:24 bobstayton Exp $
13     ********************************************************************
14
15     This file is part of the XSL DocBook Stylesheet distribution.
16     See ../README or http://nwalsh.com/docbook/xsl/ for copyright
17     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/labels.xsl"/>
29<xsl:include href="../common/titles.xsl"/>
30<xsl:include href="../common/subtitles.xsl"/>
31<xsl:include href="../common/gentext.xsl"/>
32<xsl:include href="../common/olink.xsl"/>
33<xsl:include href="../common/targets.xsl"/>
34<xsl:include href="../common/pi.xsl"/>
35<xsl:include href="autotoc.xsl"/>
36<xsl:include href="autoidx.xsl"/>
37<xsl:include href="lists.xsl"/>
38<xsl:include href="callout.xsl"/>
39<xsl:include href="verbatim.xsl"/>
40<xsl:include href="graphics.xsl"/>
41<xsl:include href="xref.xsl"/>
42<xsl:include href="formal.xsl"/>
43<xsl:include href="table.xsl"/>
44<xsl:include href="htmltbl.xsl"/>
45<xsl:include href="sections.xsl"/>
46<xsl:include href="inline.xsl"/>
47<xsl:include href="footnote.xsl"/>
48<xsl:include href="fo.xsl"/>
49<xsl:include href="fo-rtf.xsl"/>
50<xsl:include href="info.xsl"/>
51<xsl:include href="keywords.xsl"/>
52<xsl:include href="division.xsl"/>
53<xsl:include href="index.xsl"/>
54<xsl:include href="toc.xsl"/>
55<xsl:include href="refentry.xsl"/>
56<xsl:include href="math.xsl"/>
57<xsl:include href="admon.xsl"/>
58<xsl:include href="component.xsl"/>
59<xsl:include href="biblio.xsl"/>
60<xsl:include href="glossary.xsl"/>
61<xsl:include href="block.xsl"/>
62<xsl:include href="task.xsl"/>
63<xsl:include href="qandaset.xsl"/>
64<xsl:include href="synop.xsl"/>
65<xsl:include href="titlepage.xsl"/>
66<xsl:include href="titlepage.templates.xsl"/>
67<xsl:include href="pagesetup.xsl"/>
68<xsl:include href="pi.xsl"/>
69<xsl:include href="spaces.xsl"/>
70<xsl:include href="ebnf.xsl"/>
71<xsl:include href="docbookng.xsl"/>
72<xsl:include href="../html/chunker.xsl"/>
73<xsl:include href="../common/stripns.xsl"/>
74
75<xsl:include href="fop.xsl"/>
76<xsl:include href="fop1.xsl"/>
77<xsl:include href="passivetex.xsl"/>
78<xsl:include href="xep.xsl"/>
79<xsl:include href="axf.xsl"/>
80<xsl:include href="ptc.xsl"/>
81
82<xsl:param name="stylesheet.result.type" select="'fo'"/>
83
84<!-- ==================================================================== -->
85
86<xsl:key name="id" match="*" use="@id|@xml:id"/>
87
88<!-- ==================================================================== -->
89
90<xsl:template match="*">
91  <xsl:message>
92    <xsl:value-of select="name(.)"/>
93    <xsl:text> encountered</xsl:text>
94    <xsl:if test="parent::*">
95      <xsl:text> in </xsl:text>
96      <xsl:value-of select="name(parent::*)"/>
97    </xsl:if>
98    <xsl:text>, but no template matches.</xsl:text>
99  </xsl:message>
100  <fo:block color="red">
101    <xsl:text>&lt;</xsl:text>
102    <xsl:value-of select="name(.)"/>
103    <xsl:text>&gt;</xsl:text>
104    <xsl:apply-templates/> 
105    <xsl:text>&lt;/</xsl:text>
106    <xsl:value-of select="name(.)"/>
107    <xsl:text>&gt;</xsl:text>
108  </fo:block>
109</xsl:template>
110
111<!-- Update this list if new root elements supported -->
112<xsl:variable name="root.elements" select="' appendix article bibliography book chapter colophon dedication glossary index part preface qandaset refentry reference sect1 section set setindex '"/>
113
114<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>Stripping NS from DocBook 5/NG document.</xslo:message><xslo:variable name="stripped-content"><xslo:apply-templates select="/" mode="stripNS"/></xslo:variable><xslo:message>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="/">
115  <xsl:choose>
116    <xsl:when test="false()"/>
117    <xsl:otherwise>
118      <xsl:choose>
119        <xsl:when test="$rootid != ''">
120          <xsl:variable name="root.element" select="key('id', $rootid)"/>
121          <xsl:choose>
122            <xsl:when test="count($root.element) = 0">
123              <xsl:message terminate="yes">
124                <xsl:text>ID '</xsl:text>
125                <xsl:value-of select="$rootid"/>
126                <xsl:text>' not found in document.</xsl:text>
127              </xsl:message>
128            </xsl:when>
129            <xsl:when test="not(contains($root.elements, concat(' ', local-name($root.element), ' ')))">
130              <xsl:message terminate="yes">
131                <xsl:text>ERROR: Document root element ($rootid=</xsl:text>
132                <xsl:value-of select="$rootid"/>
133                <xsl:text>) for FO output </xsl:text>
134                <xsl:text>must be one of the following elements:</xsl:text>
135                <xsl:value-of select="$root.elements"/>
136              </xsl:message>
137            </xsl:when>
138            <!-- Otherwise proceed -->
139            <xsl:otherwise>
140              <xsl:if test="$collect.xref.targets = 'yes' or                             $collect.xref.targets = 'only'">
141                <xsl:apply-templates select="$root.element" mode="collect.targets"/>
142              </xsl:if>
143              <xsl:if test="$collect.xref.targets != 'only'">
144                <xsl:apply-templates select="$root.element" mode="process.root"/>
145              </xsl:if>
146            </xsl:otherwise>
147          </xsl:choose>
148        </xsl:when>
149        <!-- Otherwise process the document root element -->
150        <xsl:otherwise>
151          <xsl:variable name="document.element" select="*[1]"/>
152          <xsl:choose>
153            <xsl:when test="not(contains($root.elements,                      concat(' ', local-name($document.element), ' ')))">
154              <xsl:message terminate="yes">
155                <xsl:text>ERROR: Document root element for FO output </xsl:text>
156                <xsl:text>must be one of the following elements:</xsl:text>
157                <xsl:value-of select="$root.elements"/>
158              </xsl:message>
159            </xsl:when>
160            <!-- Otherwise proceed -->
161            <xsl:otherwise>
162              <xsl:if test="$collect.xref.targets = 'yes' or                             $collect.xref.targets = 'only'">
163                <xsl:apply-templates select="$profiled-nodes" mode="collect.targets"/>
164              </xsl:if>
165              <xsl:if test="$collect.xref.targets != 'only'">
166                <xsl:apply-templates select="$profiled-nodes" mode="process.root"/>
167              </xsl:if>
168            </xsl:otherwise>
169          </xsl:choose>
170        </xsl:otherwise>
171      </xsl:choose>
172    </xsl:otherwise>
173  </xsl:choose>
174</xsl:template>
175
176<xsl:template match="*" mode="process.root">
177  <xsl:variable name="document.element" select="self::*"/>
178
179  <xsl:call-template name="root.messages"/>
180
181  <xsl:variable name="title">
182    <xsl:choose>
183      <xsl:when test="$document.element/title[1]">
184        <xsl:value-of select="$document.element/title[1]"/>
185      </xsl:when>
186      <xsl:otherwise>[could not find document title]</xsl:otherwise>
187    </xsl:choose>
188  </xsl:variable>
189  
190  <!-- Include all id values in XEP output -->
191  <xsl:if test="$xep.extensions != 0">
192    <xsl:processing-instruction name="xep-pdf-drop-unused-destinations">false</xsl:processing-instruction>
193  </xsl:if>
194
195  <fo:root xsl:use-attribute-sets="root.properties">
196    <xsl:attribute name="language">
197      <xsl:call-template name="l10n.language">
198        <xsl:with-param name="target" select="/*[1]"/>
199      </xsl:call-template>
200    </xsl:attribute>
201
202    <xsl:if test="$xep.extensions != 0">
203      <xsl:call-template name="xep-pis"/>
204      <xsl:call-template name="xep-document-information"/>
205    </xsl:if>
206    <xsl:if test="$axf.extensions != 0">
207      <xsl:call-template name="axf-document-information"/>
208    </xsl:if>
209
210    <xsl:call-template name="setup.pagemasters"/>
211
212    <xsl:if test="$fop.extensions != 0">
213      <xsl:apply-templates select="$document.element" mode="fop.outline"/>
214    </xsl:if>
215
216    <xsl:if test="$fop1.extensions != 0">
217      <xsl:variable name="bookmarks">
218        <xsl:apply-templates select="$document.element" mode="fop1.outline"/>
219      </xsl:variable>
220      <xsl:if test="string($bookmarks) != ''">
221        <fo:bookmark-tree>
222          <xsl:copy-of select="$bookmarks"/>
223	</fo:bookmark-tree>
224      </xsl:if>
225    </xsl:if>
226
227    <xsl:if test="$xep.extensions != 0">
228      <xsl:variable name="bookmarks">
229        <xsl:apply-templates select="$document.element" mode="xep.outline"/>
230      </xsl:variable>
231      <xsl:if test="string($bookmarks) != ''">
232        <rx:outline xmlns:rx="http://www.renderx.com/XSL/Extensions">
233          <xsl:copy-of select="$bookmarks"/>
234        </rx:outline>
235      </xsl:if>
236    </xsl:if>
237
238    <xsl:if test="$arbortext.extensions != 0 and $ati.xsl11.bookmarks != 0">
239      <xsl:variable name="bookmarks">
240	<xsl:apply-templates select="$document.element" mode="ati.xsl11.bookmarks"/>
241      </xsl:variable>
242      <xsl:if test="string($bookmarks) != ''">
243	<fo:bookmark-tree>
244	  <xsl:copy-of select="$bookmarks"/>
245	</fo:bookmark-tree>
246      </xsl:if>
247    </xsl:if>
248
249    <xsl:apply-templates select="$document.element"/>
250  </fo:root>
251</xsl:template>
252
253<xsl:template name="root.messages">
254  <!-- redefine this any way you'd like to output messages -->
255  <!-- DO NOT OUTPUT ANYTHING FROM THIS TEMPLATE -->
256  <xsl:message>
257    <xsl:text>Making </xsl:text>
258    <xsl:value-of select="$page.orientation"/>
259    <xsl:text> pages on </xsl:text>
260    <xsl:value-of select="$paper.type"/>
261    <xsl:text> paper (</xsl:text>
262    <xsl:value-of select="$page.width"/>
263    <xsl:text>x</xsl:text>
264    <xsl:value-of select="$page.height"/>
265    <xsl:text>)</xsl:text>
266  </xsl:message>
267</xsl:template>
268
269<!-- ==================================================================== -->
270
271</xsl:stylesheet>
272