source: BOOK/stylesheets/lfs-xsl/docbook-xsl-snapshot/xhtml/chunker.xsl@ b7c7511

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

Added LFS XSL Stylesheets.

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