1 <?xml version="1.0" encoding="ASCII"?><!--This file was created automatically by html2xhtml--><!--from the HTML stylesheets.--><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:d="http://docbook.org/ns/docbook" xmlns:saxon="http://icl.com/saxon" xmlns:lxslt="http://xml.apache.org/xslt" xmlns:redirect="http://xml.apache.org/xalan/redirect" xmlns:exsl="http://exslt.org/common" xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" xmlns="http://www.w3.org/1999/xhtml" version="1.0" exclude-result-prefixes="saxon lxslt redirect exsl doc d" extension-element-prefixes="saxon redirect lxslt exsl">
3 <!-- ********************************************************************
5 This file is part of the XSL DocBook Stylesheet distribution.
6 See ../README or http://cdn.docbook.org/release/xsl/current/ for
7 copyright and other information.
9 ******************************************************************** -->
11 <!-- ==================================================================== -->
13 <!-- This stylesheet works with XSLT implementations that support -->
14 <!-- exsl:document, saxon:output, or Xalan's redirect:write -->
15 <!-- Note: Only Saxon 6.4.2 or later is supported. -->
17 <xsl:param name="chunker.output.method" select="'xml'"/>
18 <xsl:param name="chunker.output.encoding" select="'UTF-8'"/>
19 <xsl:param name="chunker.output.indent" select="'no'"/>
20 <xsl:param name="chunker.output.omit-xml-declaration" select="'no'"/>
21 <xsl:param name="chunker.output.standalone" select="'no'"/>
22 <xsl:param name="chunker.output.doctype-public" select="'-//W3C//DTD XHTML 1.0 Transitional//EN'"/>
23 <xsl:param name="chunker.output.doctype-system" select="'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'"/>
24 <xsl:param name="chunker.output.media-type" select="''"/>
25 <xsl:param name="chunker.output.cdata-section-elements" select="''"/>
27 <!-- Make sure base.dir has a trailing slash. -->
28 <!-- This is an internal-only variable. Customize $base.dir instead. -->
29 <xsl:variable name="chunk.base.dir">
31 <xsl:when test="string-length($base.dir) = 0"/>
32 <!-- make sure to add trailing slash if omitted by user -->
33 <xsl:when test="substring($base.dir, string-length($base.dir), 1) = '/'">
34 <xsl:value-of select="$base.dir"/>
37 <xsl:value-of select="concat($base.dir, '/')"/>
42 <xsl:param name="saxon.character.representation" select="'entity;decimal'"/>
44 <!-- ==================================================================== -->
46 <xsl:template name="make-relative-filename">
47 <xsl:param name="base.dir" select="'./'"/>
48 <xsl:param name="base.name" select="''"/>
51 <!-- put Saxon first to work around a bug in libxslt -->
52 <xsl:when test="element-available('saxon:output')">
53 <!-- Saxon doesn't make the chunks relative -->
54 <xsl:value-of select="concat($base.dir,$base.name)"/>
56 <xsl:when test="element-available('exsl:document')">
57 <!-- EXSL document does make the chunks relative, I think -->
59 <xsl:when test="count(parent::*) = 0">
60 <xsl:value-of select="concat($base.dir,$base.name)"/>
63 <xsl:value-of select="$base.name"/>
67 <xsl:when test="element-available('redirect:write')">
68 <!-- Xalan doesn't make the chunks relative -->
69 <xsl:value-of select="concat($base.dir,$base.name)"/>
72 <xsl:message terminate="yes">
73 <xsl:text>Don't know how to chunk with </xsl:text>
74 <xsl:value-of select="system-property('xsl:vendor')"/>
80 <xsl:template name="write.chunk">
81 <xsl:param name="filename" select="''"/>
82 <xsl:param name="quiet" select="$chunk.quietly"/>
83 <xsl:param name="suppress-context-node-name" select="0"/>
84 <xsl:param name="message-prolog"/>
85 <xsl:param name="message-epilog"/>
87 <xsl:param name="method" select="$chunker.output.method"/>
88 <xsl:param name="encoding" select="$chunker.output.encoding"/>
89 <xsl:param name="indent" select="$chunker.output.indent"/>
90 <xsl:param name="omit-xml-declaration" select="$chunker.output.omit-xml-declaration"/>
91 <xsl:param name="standalone" select="$chunker.output.standalone"/>
92 <xsl:param name="doctype-public" select="$chunker.output.doctype-public"/>
93 <xsl:param name="doctype-system" select="$chunker.output.doctype-system"/>
94 <xsl:param name="media-type" select="$chunker.output.media-type"/>
95 <xsl:param name="cdata-section-elements" select="$chunker.output.cdata-section-elements"/>
97 <xsl:param name="content"/>
99 <xsl:if test="$quiet = 0">
101 <xsl:if test="not($message-prolog = '')">
102 <xsl:value-of select="$message-prolog"/>
104 <xsl:text>Writing </xsl:text>
105 <xsl:value-of select="$filename"/>
106 <xsl:if test="name(.) != '' and $suppress-context-node-name = 0">
107 <xsl:text> for </xsl:text>
108 <xsl:value-of select="name(.)"/>
109 <xsl:if test="@id or @xml:id">
110 <xsl:text>(</xsl:text>
111 <xsl:value-of select="(@id|@xml:id)[1]"/>
112 <xsl:text>)</xsl:text>
115 <xsl:if test="not($message-epilog = '')">
116 <xsl:value-of select="$message-epilog"/>
122 <xsl:when test="element-available('exsl:document')">
124 <!-- Handle the permutations ... -->
125 <xsl:when test="$media-type != ''">
127 <xsl:when test="$doctype-public != '' and $doctype-system != ''">
128 <exsl:document href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" media-type="{$media-type}" doctype-public="{$doctype-public}" doctype-system="{$doctype-system}" standalone="{$standalone}">
129 <xsl:copy-of select="$content"/>
132 <xsl:when test="$doctype-public != '' and $doctype-system = ''">
133 <exsl:document href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" media-type="{$media-type}" doctype-public="{$doctype-public}" standalone="{$standalone}">
134 <xsl:copy-of select="$content"/>
137 <xsl:when test="$doctype-public = '' and $doctype-system != ''">
138 <exsl:document href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" media-type="{$media-type}" doctype-system="{$doctype-system}" standalone="{$standalone}">
139 <xsl:copy-of select="$content"/>
142 <xsl:otherwise><!-- $doctype-public = '' and $doctype-system = ''"> -->
143 <exsl:document href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" media-type="{$media-type}" standalone="{$standalone}">
144 <xsl:copy-of select="$content"/>
151 <xsl:when test="$doctype-public != '' and $doctype-system != ''">
152 <exsl:document href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" doctype-public="{$doctype-public}" doctype-system="{$doctype-system}" standalone="{$standalone}">
153 <xsl:copy-of select="$content"/>
156 <xsl:when test="$doctype-public != '' and $doctype-system = ''">
157 <exsl:document href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" doctype-public="{$doctype-public}" standalone="{$standalone}">
158 <xsl:copy-of select="$content"/>
161 <xsl:when test="$doctype-public = '' and $doctype-system != ''">
162 <exsl:document href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" doctype-system="{$doctype-system}" standalone="{$standalone}">
163 <xsl:copy-of select="$content"/>
166 <xsl:otherwise><!-- $doctype-public = '' and $doctype-system = ''"> -->
167 <exsl:document href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" standalone="{$standalone}">
168 <xsl:copy-of select="$content"/>
176 <xsl:when test="element-available('saxon:output')">
178 <!-- Handle the permutations ... -->
179 <xsl:when test="$media-type != ''">
181 <xsl:when test="$doctype-public != '' and $doctype-system != ''">
182 <saxon:output saxon:character-representation="{$saxon.character.representation}" href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" media-type="{$media-type}" doctype-public="{$doctype-public}" doctype-system="{$doctype-system}" standalone="{$standalone}">
183 <xsl:copy-of select="$content"/>
186 <xsl:when test="$doctype-public != '' and $doctype-system = ''">
187 <saxon:output saxon:character-representation="{$saxon.character.representation}" href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" media-type="{$media-type}" doctype-public="{$doctype-public}" standalone="{$standalone}">
188 <xsl:copy-of select="$content"/>
191 <xsl:when test="$doctype-public = '' and $doctype-system != ''">
192 <saxon:output saxon:character-representation="{$saxon.character.representation}" href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" media-type="{$media-type}" doctype-system="{$doctype-system}" standalone="{$standalone}">
193 <xsl:copy-of select="$content"/>
196 <xsl:otherwise><!-- $doctype-public = '' and $doctype-system = ''"> -->
197 <saxon:output saxon:character-representation="{$saxon.character.representation}" href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" media-type="{$media-type}" standalone="{$standalone}">
198 <xsl:copy-of select="$content"/>
205 <xsl:when test="$doctype-public != '' and $doctype-system != ''">
206 <saxon:output saxon:character-representation="{$saxon.character.representation}" href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" doctype-public="{$doctype-public}" doctype-system="{$doctype-system}" standalone="{$standalone}">
207 <xsl:copy-of select="$content"/>
210 <xsl:when test="$doctype-public != '' and $doctype-system = ''">
211 <saxon:output saxon:character-representation="{$saxon.character.representation}" href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" doctype-public="{$doctype-public}" standalone="{$standalone}">
212 <xsl:copy-of select="$content"/>
215 <xsl:when test="$doctype-public = '' and $doctype-system != ''">
216 <saxon:output saxon:character-representation="{$saxon.character.representation}" href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" doctype-system="{$doctype-system}" standalone="{$standalone}">
217 <xsl:copy-of select="$content"/>
220 <xsl:otherwise><!-- $doctype-public = '' and $doctype-system = ''"> -->
221 <saxon:output saxon:character-representation="{$saxon.character.representation}" href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" standalone="{$standalone}">
222 <xsl:copy-of select="$content"/>
230 <xsl:when test="element-available('redirect:write')">
231 <!-- Xalan uses redirect -->
232 <redirect:write file="{$filename}">
233 <xsl:copy-of select="$content"/>
238 <!-- it doesn't matter since we won't be making chunks... -->
239 <xsl:message terminate="yes">
240 <xsl:text>Can't make chunks with </xsl:text>
241 <xsl:value-of select="system-property('xsl:vendor')"/>
242 <xsl:text>'s processor.</xsl:text>
248 <xsl:template name="write.chunk.with.doctype">
249 <xsl:param name="filename" select="''"/>
250 <xsl:param name="quiet" select="$chunk.quietly"/>
252 <xsl:param name="method" select="$chunker.output.method"/>
253 <xsl:param name="encoding" select="$chunker.output.encoding"/>
254 <xsl:param name="indent" select="$chunker.output.indent"/>
255 <xsl:param name="omit-xml-declaration" select="$chunker.output.omit-xml-declaration"/>
256 <xsl:param name="standalone" select="$chunker.output.standalone"/>
257 <xsl:param name="doctype-public" select="$chunker.output.doctype-public"/>
258 <xsl:param name="doctype-system" select="$chunker.output.doctype-system"/>
259 <xsl:param name="media-type" select="$chunker.output.media-type"/>
260 <xsl:param name="cdata-section-elements" select="$chunker.output.cdata-section-elements"/>
262 <xsl:param name="content"/>
264 <xsl:call-template name="write.chunk">
265 <xsl:with-param name="filename" select="$filename"/>
266 <xsl:with-param name="quiet" select="$quiet"/>
267 <xsl:with-param name="method" select="$method"/>
268 <xsl:with-param name="encoding" select="$encoding"/>
269 <xsl:with-param name="indent" select="$indent"/>
270 <xsl:with-param name="omit-xml-declaration" select="$omit-xml-declaration"/>
271 <xsl:with-param name="standalone" select="$standalone"/>
272 <xsl:with-param name="doctype-public" select="$doctype-public"/>
273 <xsl:with-param name="doctype-system" select="$doctype-system"/>
274 <xsl:with-param name="media-type" select="$media-type"/>
275 <xsl:with-param name="cdata-section-elements" select="$cdata-section-elements"/>
276 <xsl:with-param name="content" select="$content"/>
280 <xsl:template name="write.text.chunk">
281 <xsl:param name="filename" select="''"/>
282 <xsl:param name="quiet" select="$chunk.quietly"/>
283 <xsl:param name="suppress-context-node-name" select="0"/>
284 <xsl:param name="message-prolog"/>
285 <xsl:param name="message-epilog"/>
286 <xsl:param name="method" select="'text'"/>
287 <xsl:param name="encoding" select="$chunker.output.encoding"/>
288 <xsl:param name="media-type" select="$chunker.output.media-type"/>
289 <xsl:param name="content"/>
291 <xsl:call-template name="write.chunk">
292 <xsl:with-param name="filename" select="$filename"/>
293 <xsl:with-param name="quiet" select="$quiet"/>
294 <xsl:with-param name="suppress-context-node-name" select="$suppress-context-node-name"/>
295 <xsl:with-param name="message-prolog" select="$message-prolog"/>
296 <xsl:with-param name="message-epilog" select="$message-epilog"/>
297 <xsl:with-param name="method" select="$method"/>
298 <xsl:with-param name="encoding" select="$encoding"/>
299 <xsl:with-param name="indent" select="'no'"/>
300 <xsl:with-param name="omit-xml-declaration" select="'yes'"/>
301 <xsl:with-param name="standalone" select="'no'"/>
302 <xsl:with-param name="doctype-public"/>
303 <xsl:with-param name="doctype-system"/>
304 <xsl:with-param name="media-type" select="$media-type"/>
305 <xsl:with-param name="cdata-section-elements"/>
306 <xsl:with-param name="content" select="$content"/>