source: stylesheets/lfs-xsl/docbook-xsl-1.78.1/xhtml-1_1/chunker.xsl@ c158fe6

7.5-systemd 7.6-systemd 7.7-systemd 7.8-systemd 7.9-systemd
Last change on this file since c158fe6 was b1a51ac1, checked in by Krejzi <krejzi@…>, 11 years ago

Import new branch

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/systemd/BOOK@10389 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 17.5 KB
Line 
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: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" extension-element-prefixes="saxon redirect lxslt exsl">
2
3<!-- ********************************************************************
4 $Id: chunker.xsl 9656 2012-10-29 18:09:53Z bobstayton $
5 ********************************************************************
6
7 This file is part of the XSL DocBook Stylesheet distribution.
8 See ../README or http://docbook.sf.net/release/xsl/current/ for
9 copyright and other information.
10
11 ******************************************************************** -->
12
13<!-- ==================================================================== -->
14
15<!-- This stylesheet works with XSLT implementations that support -->
16<!-- exsl:document, saxon:output, or Xalan's redirect:write -->
17<!-- Note: Only Saxon 6.4.2 or later is supported. -->
18
19<xsl:param name="chunker.output.method" select="'xml'"/>
20<xsl:param name="chunker.output.encoding" select="'UTF-8'"/>
21<xsl:param name="chunker.output.indent" select="'no'"/>
22<xsl:param name="chunker.output.omit-xml-declaration" select="'no'"/>
23<xsl:param name="chunker.output.standalone" select="'no'"/>
24<xsl:param name="chunker.output.doctype-public" select="'-//W3C//DTD XHTML 1.1//EN'"/>
25<xsl:param name="chunker.output.doctype-system" select="'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd'"/>
26<xsl:param name="chunker.output.media-type" select="''"/>
27<xsl:param name="chunker.output.cdata-section-elements" select="''"/>
28
29<!-- Make sure base.dir has a trailing slash now -->
30<xsl:param name="chunk.base.dir">
31 <xsl:choose>
32 <xsl:when test="string-length($base.dir) = 0"/>
33 <!-- make sure to add trailing slash if omitted by user -->
34 <xsl:when test="substring($base.dir, string-length($base.dir), 1) = '/'">
35 <xsl:value-of select="$base.dir"/>
36 </xsl:when>
37 <xsl:otherwise>
38 <xsl:value-of select="concat($base.dir, '/')"/>
39 </xsl:otherwise>
40 </xsl:choose>
41</xsl:param>
42
43<xsl:param name="saxon.character.representation" select="'entity;decimal'"/>
44
45<!-- ==================================================================== -->
46
47<xsl:template name="make-relative-filename">
48 <xsl:param name="base.dir" select="'./'"/>
49 <xsl:param name="base.name" select="''"/>
50
51 <xsl:choose>
52 <!-- put Saxon first to work around a bug in libxslt -->
53 <xsl:when test="element-available('saxon:output')">
54 <!-- Saxon doesn't make the chunks relative -->
55 <xsl:value-of select="concat($base.dir,$base.name)"/>
56 </xsl:when>
57 <xsl:when test="element-available('exsl:document')">
58 <!-- EXSL document does make the chunks relative, I think -->
59 <xsl:choose>
60 <xsl:when test="count(parent::*) = 0">
61 <xsl:value-of select="concat($base.dir,$base.name)"/>
62 </xsl:when>
63 <xsl:otherwise>
64 <xsl:value-of select="$base.name"/>
65 </xsl:otherwise>
66 </xsl:choose>
67 </xsl:when>
68 <xsl:when test="element-available('redirect:write')">
69 <!-- Xalan doesn't make the chunks relative -->
70 <xsl:value-of select="concat($base.dir,$base.name)"/>
71 </xsl:when>
72 <xsl:otherwise>
73 <xsl:message terminate="yes">
74 <xsl:text>Don't know how to chunk with </xsl:text>
75 <xsl:value-of select="system-property('xsl:vendor')"/>
76 </xsl:message>
77 </xsl:otherwise>
78 </xsl:choose>
79</xsl:template>
80
81<xsl:template name="write.chunk">
82 <xsl:param name="filename" select="''"/>
83 <xsl:param name="quiet" select="$chunk.quietly"/>
84 <xsl:param name="suppress-context-node-name" select="0"/>
85 <xsl:param name="message-prolog"/>
86 <xsl:param name="message-epilog"/>
87
88 <xsl:param name="method" select="$chunker.output.method"/>
89 <xsl:param name="encoding" select="$chunker.output.encoding"/>
90 <xsl:param name="indent" select="$chunker.output.indent"/>
91 <xsl:param name="omit-xml-declaration" select="$chunker.output.omit-xml-declaration"/>
92 <xsl:param name="standalone" select="$chunker.output.standalone"/>
93 <xsl:param name="doctype-public" select="$chunker.output.doctype-public"/>
94 <xsl:param name="doctype-system" select="$chunker.output.doctype-system"/>
95 <xsl:param name="media-type" select="$chunker.output.media-type"/>
96 <xsl:param name="cdata-section-elements" select="$chunker.output.cdata-section-elements"/>
97
98 <xsl:param name="content"/>
99
100 <xsl:if test="$quiet = 0">
101 <xsl:message>
102 <xsl:if test="not($message-prolog = '')">
103 <xsl:value-of select="$message-prolog"/>
104 </xsl:if>
105 <xsl:text>Writing </xsl:text>
106 <xsl:value-of select="$filename"/>
107 <xsl:if test="name(.) != '' and $suppress-context-node-name = 0">
108 <xsl:text> for </xsl:text>
109 <xsl:value-of select="name(.)"/>
110 <xsl:if test="@id or @xml:id">
111 <xsl:text>(</xsl:text>
112 <xsl:value-of select="(@id|@xml:id)[1]"/>
113 <xsl:text>)</xsl:text>
114 </xsl:if>
115 </xsl:if>
116 <xsl:if test="not($message-epilog = '')">
117 <xsl:value-of select="$message-epilog"/>
118 </xsl:if>
119 </xsl:message>
120 </xsl:if>
121
122 <xsl:choose>
123 <xsl:when test="element-available('exsl:document')">
124 <xsl:choose>
125 <!-- Handle the permutations ... -->
126 <xsl:when test="$media-type != ''">
127 <xsl:choose>
128 <xsl:when test="$doctype-public != '' and $doctype-system != ''">
129 <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}">
130 <xsl:copy-of select="$content"/>
131 </exsl:document>
132 </xsl:when>
133 <xsl:when test="$doctype-public != '' and $doctype-system = ''">
134 <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}">
135 <xsl:copy-of select="$content"/>
136 </exsl:document>
137 </xsl:when>
138 <xsl:when test="$doctype-public = '' and $doctype-system != ''">
139 <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}">
140 <xsl:copy-of select="$content"/>
141 </exsl:document>
142 </xsl:when>
143 <xsl:otherwise><!-- $doctype-public = '' and $doctype-system = ''"> -->
144 <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}">
145 <xsl:copy-of select="$content"/>
146 </exsl:document>
147 </xsl:otherwise>
148 </xsl:choose>
149 </xsl:when>
150 <xsl:otherwise>
151 <xsl:choose>
152 <xsl:when test="$doctype-public != '' and $doctype-system != ''">
153 <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}">
154 <xsl:copy-of select="$content"/>
155 </exsl:document>
156 </xsl:when>
157 <xsl:when test="$doctype-public != '' and $doctype-system = ''">
158 <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}">
159 <xsl:copy-of select="$content"/>
160 </exsl:document>
161 </xsl:when>
162 <xsl:when test="$doctype-public = '' and $doctype-system != ''">
163 <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}">
164 <xsl:copy-of select="$content"/>
165 </exsl:document>
166 </xsl:when>
167 <xsl:otherwise><!-- $doctype-public = '' and $doctype-system = ''"> -->
168 <exsl:document href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" standalone="{$standalone}">
169 <xsl:copy-of select="$content"/>
170 </exsl:document>
171 </xsl:otherwise>
172 </xsl:choose>
173 </xsl:otherwise>
174 </xsl:choose>
175 </xsl:when>
176
177 <xsl:when test="element-available('saxon:output')">
178 <xsl:choose>
179 <!-- Handle the permutations ... -->
180 <xsl:when test="$media-type != ''">
181 <xsl:choose>
182 <xsl:when test="$doctype-public != '' and $doctype-system != ''">
183 <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}">
184 <xsl:copy-of select="$content"/>
185 </saxon:output>
186 </xsl:when>
187 <xsl:when test="$doctype-public != '' and $doctype-system = ''">
188 <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}">
189 <xsl:copy-of select="$content"/>
190 </saxon:output>
191 </xsl:when>
192 <xsl:when test="$doctype-public = '' and $doctype-system != ''">
193 <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}">
194 <xsl:copy-of select="$content"/>
195 </saxon:output>
196 </xsl:when>
197 <xsl:otherwise><!-- $doctype-public = '' and $doctype-system = ''"> -->
198 <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}">
199 <xsl:copy-of select="$content"/>
200 </saxon:output>
201 </xsl:otherwise>
202 </xsl:choose>
203 </xsl:when>
204 <xsl:otherwise>
205 <xsl:choose>
206 <xsl:when test="$doctype-public != '' and $doctype-system != ''">
207 <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}">
208 <xsl:copy-of select="$content"/>
209 </saxon:output>
210 </xsl:when>
211 <xsl:when test="$doctype-public != '' and $doctype-system = ''">
212 <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}">
213 <xsl:copy-of select="$content"/>
214 </saxon:output>
215 </xsl:when>
216 <xsl:when test="$doctype-public = '' and $doctype-system != ''">
217 <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}">
218 <xsl:copy-of select="$content"/>
219 </saxon:output>
220 </xsl:when>
221 <xsl:otherwise><!-- $doctype-public = '' and $doctype-system = ''"> -->
222 <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}">
223 <xsl:copy-of select="$content"/>
224 </saxon:output>
225 </xsl:otherwise>
226 </xsl:choose>
227 </xsl:otherwise>
228 </xsl:choose>
229 </xsl:when>
230
231 <xsl:when test="element-available('redirect:write')">
232 <!-- Xalan uses redirect -->
233 <redirect:write file="{$filename}">
234 <xsl:copy-of select="$content"/>
235 </redirect:write>
236 </xsl:when>
237
238 <xsl:otherwise>
239 <!-- it doesn't matter since we won't be making chunks... -->
240 <xsl:message terminate="yes">
241 <xsl:text>Can't make chunks with </xsl:text>
242 <xsl:value-of select="system-property('xsl:vendor')"/>
243 <xsl:text>'s processor.</xsl:text>
244 </xsl:message>
245 </xsl:otherwise>
246 </xsl:choose>
247</xsl:template>
248
249<xsl:template name="write.chunk.with.doctype">
250 <xsl:param name="filename" select="''"/>
251 <xsl:param name="quiet" select="$chunk.quietly"/>
252
253 <xsl:param name="method" select="$chunker.output.method"/>
254 <xsl:param name="encoding" select="$chunker.output.encoding"/>
255 <xsl:param name="indent" select="$chunker.output.indent"/>
256 <xsl:param name="omit-xml-declaration" select="$chunker.output.omit-xml-declaration"/>
257 <xsl:param name="standalone" select="$chunker.output.standalone"/>
258 <xsl:param name="doctype-public" select="$chunker.output.doctype-public"/>
259 <xsl:param name="doctype-system" select="$chunker.output.doctype-system"/>
260 <xsl:param name="media-type" select="$chunker.output.media-type"/>
261 <xsl:param name="cdata-section-elements" select="$chunker.output.cdata-section-elements"/>
262
263 <xsl:param name="content"/>
264
265 <xsl:call-template name="write.chunk">
266 <xsl:with-param name="filename" select="$filename"/>
267 <xsl:with-param name="quiet" select="$quiet"/>
268 <xsl:with-param name="method" select="$method"/>
269 <xsl:with-param name="encoding" select="$encoding"/>
270 <xsl:with-param name="indent" select="$indent"/>
271 <xsl:with-param name="omit-xml-declaration" select="$omit-xml-declaration"/>
272 <xsl:with-param name="standalone" select="$standalone"/>
273 <xsl:with-param name="doctype-public" select="$doctype-public"/>
274 <xsl:with-param name="doctype-system" select="$doctype-system"/>
275 <xsl:with-param name="media-type" select="$media-type"/>
276 <xsl:with-param name="cdata-section-elements" select="$cdata-section-elements"/>
277 <xsl:with-param name="content" select="$content"/>
278 </xsl:call-template>
279</xsl:template>
280
281<xsl:template name="write.text.chunk">
282 <xsl:param name="filename" select="''"/>
283 <xsl:param name="quiet" select="$chunk.quietly"/>
284 <xsl:param name="suppress-context-node-name" select="0"/>
285 <xsl:param name="message-prolog"/>
286 <xsl:param name="message-epilog"/>
287 <xsl:param name="method" select="'text'"/>
288 <xsl:param name="encoding" select="$chunker.output.encoding"/>
289 <xsl:param name="media-type" select="$chunker.output.media-type"/>
290 <xsl:param name="content"/>
291
292 <xsl:call-template name="write.chunk">
293 <xsl:with-param name="filename" select="$filename"/>
294 <xsl:with-param name="quiet" select="$quiet"/>
295 <xsl:with-param name="suppress-context-node-name" select="$suppress-context-node-name"/>
296 <xsl:with-param name="message-prolog" select="$message-prolog"/>
297 <xsl:with-param name="message-epilog" select="$message-epilog"/>
298 <xsl:with-param name="method" select="$method"/>
299 <xsl:with-param name="encoding" select="$encoding"/>
300 <xsl:with-param name="indent" select="'no'"/>
301 <xsl:with-param name="omit-xml-declaration" select="'yes'"/>
302 <xsl:with-param name="standalone" select="'no'"/>
303 <xsl:with-param name="doctype-public"/>
304 <xsl:with-param name="doctype-system"/>
305 <xsl:with-param name="media-type" select="$media-type"/>
306 <xsl:with-param name="cdata-section-elements"/>
307 <xsl:with-param name="content" select="$content"/>
308 </xsl:call-template>
309</xsl:template>
310
311
312</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.