OLD | NEW |
| (Empty) |
1 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
2 xmlns:saxon="http://icl.com/saxon" | |
3 xmlns:lxslt="http://xml.apache.org/xslt" | |
4 xmlns:redirect="http://xml.apache.org/xalan/redirect" | |
5 xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" | |
6 version="1.1" | |
7 exclude-result-prefixes="doc" | |
8 extension-element-prefixes="saxon redirect lxslt"> | |
9 | |
10 <!-- ******************************************************************** | |
11 $Id: oldchunker.xsl 6910 2007-06-28 23:23:30Z xmldoc $ | |
12 ******************************************************************** | |
13 | |
14 This file is part of the XSL DocBook Stylesheet distribution. | |
15 See ../README or http://docbook.sf.net/release/xsl/current/ for | |
16 copyright and other information. | |
17 | |
18 ******************************************************************** --> | |
19 | |
20 <!-- ==================================================================== --> | |
21 | |
22 <!-- This stylesheet works with Saxon and Xalan; for XT use xtchunker.xsl --> | |
23 | |
24 <!-- ==================================================================== --> | |
25 | |
26 <xsl:param name="default.encoding" select="'ISO-8859-1'" doc:type='string'/> | |
27 | |
28 <doc:param name="default.encoding" xmlns=""> | |
29 <refpurpose>Encoding used in generated HTML pages</refpurpose> | |
30 <refdescription> | |
31 <para>This encoding is used in files generated by chunking stylesheet. Currently | |
32 only Saxon is able to change output encoding. | |
33 </para> | |
34 </refdescription> | |
35 </doc:param> | |
36 | |
37 <!-- ==================================================================== --> | |
38 | |
39 <xsl:param name="saxon.character.representation" select="'entity;decimal'" doc:t
ype='string'/> | |
40 | |
41 <doc:param name="saxon.character.representation" xmlns=""> | |
42 <refpurpose>Saxon character representation used in generated HTML pages</refpurp
ose> | |
43 <refdescription> | |
44 <para>This character representation is used in files generated by chunking style
sheet. If | |
45 you want to suppress entity references for characters with direct representation
| |
46 in default.encoding, set this parameter to value <literal>native</literal>. | |
47 </para> | |
48 </refdescription> | |
49 </doc:param> | |
50 | |
51 <!-- ==================================================================== --> | |
52 | |
53 <xsl:template name="make-relative-filename"> | |
54 <xsl:param name="base.dir" select="'./'"/> | |
55 <xsl:param name="base.name" select="''"/> | |
56 | |
57 <xsl:variable name="vendor" select="system-property('xsl:vendor')"/> | |
58 | |
59 <xsl:choose> | |
60 <xsl:when test="contains($vendor, 'SAXON')"> | |
61 <!-- Saxon doesn't make the chunks relative --> | |
62 <xsl:value-of select="concat($base.dir,$base.name)"/> | |
63 </xsl:when> | |
64 <xsl:when test="contains($vendor, 'Apache')"> | |
65 <!-- Xalan doesn't make the chunks relative --> | |
66 <xsl:value-of select="concat($base.dir,$base.name)"/> | |
67 </xsl:when> | |
68 <xsl:otherwise> | |
69 <xsl:message terminate="yes"> | |
70 <xsl:text>Chunking isn't supported with </xsl:text> | |
71 <xsl:value-of select="$vendor"/> | |
72 </xsl:message> | |
73 </xsl:otherwise> | |
74 </xsl:choose> | |
75 </xsl:template> | |
76 | |
77 <xsl:template name="write.chunk"> | |
78 <xsl:param name="filename" select="''"/> | |
79 <xsl:param name="method" select="'html'"/> | |
80 <xsl:param name="encoding" select="$default.encoding"/> | |
81 <xsl:param name="indent" select="'no'"/> | |
82 <xsl:param name="content" select="''"/> | |
83 | |
84 <xsl:message> | |
85 <xsl:text>Writing </xsl:text> | |
86 <xsl:value-of select="$filename"/> | |
87 <xsl:if test="name(.) != ''"> | |
88 <xsl:text> for </xsl:text> | |
89 <xsl:value-of select="name(.)"/> | |
90 <xsl:if test="@id"> | |
91 <xsl:text>(</xsl:text> | |
92 <xsl:value-of select="@id"/> | |
93 <xsl:text>)</xsl:text> | |
94 </xsl:if> | |
95 </xsl:if> | |
96 </xsl:message> | |
97 | |
98 <xsl:variable name="vendor" select="system-property('xsl:vendor')"/> | |
99 | |
100 <xsl:choose> | |
101 <xsl:when test="contains($vendor, 'SAXON 6.2')"> | |
102 <!-- Saxon 6.2.x uses xsl:document --> | |
103 <xsl:document href="{$filename}" | |
104 method="{$method}" | |
105 encoding="{$encoding}" | |
106 indent="{$indent}" | |
107 saxon:character-representation="{$saxon.character.representa
tion}"> | |
108 <xsl:copy-of select="$content"/> | |
109 </xsl:document> | |
110 </xsl:when> | |
111 <xsl:when test="contains($vendor, 'SAXON')"> | |
112 <!-- Saxon uses saxon:output --> | |
113 <saxon:output file="{$filename}" | |
114 href="{$filename}" | |
115 method="{$method}" | |
116 encoding="{$encoding}" | |
117 indent="{$indent}" | |
118 saxon:character-representation="{$saxon.character.representa
tion}"> | |
119 <xsl:copy-of select="$content"/> | |
120 </saxon:output> | |
121 </xsl:when> | |
122 <xsl:when test="contains($vendor, 'Apache')"> | |
123 <!-- Xalan uses redirect --> | |
124 <redirect:write file="{$filename}"> | |
125 <xsl:copy-of select="$content"/> | |
126 </redirect:write> | |
127 </xsl:when> | |
128 <xsl:otherwise> | |
129 <!-- it doesn't matter since we won't be making chunks... --> | |
130 <xsl:message terminate="yes"> | |
131 <xsl:text>Can't make chunks with </xsl:text> | |
132 <xsl:value-of select="$vendor"/> | |
133 <xsl:text>'s processor.</xsl:text> | |
134 </xsl:message> | |
135 </xsl:otherwise> | |
136 </xsl:choose> | |
137 </xsl:template> | |
138 | |
139 <xsl:template name="write.chunk.with.doctype"> | |
140 <xsl:param name="filename" select="''"/> | |
141 <xsl:param name="method" select="'html'"/> | |
142 <xsl:param name="encoding" select="$default.encoding"/> | |
143 <xsl:param name="indent" select="'no'"/> | |
144 <xsl:param name="doctype-public" select="''"/> | |
145 <xsl:param name="doctype-system" select="''"/> | |
146 <xsl:param name="content" select="''"/> | |
147 | |
148 <xsl:message> | |
149 <xsl:text>Writing </xsl:text> | |
150 <xsl:value-of select="$filename"/> | |
151 <xsl:if test="name(.) != ''"> | |
152 <xsl:text> for </xsl:text> | |
153 <xsl:value-of select="name(.)"/> | |
154 </xsl:if> | |
155 </xsl:message> | |
156 | |
157 <xsl:variable name="vendor" select="system-property('xsl:vendor')"/> | |
158 | |
159 <xsl:choose> | |
160 <xsl:when test="contains($vendor, 'SAXON 6.2')"> | |
161 <!-- Saxon 6.2.x uses xsl:document --> | |
162 <xsl:document href="{$filename}" | |
163 method="{$method}" | |
164 encoding="{$encoding}" | |
165 indent="{$indent}" | |
166 doctype-public="{$doctype-public}" | |
167 doctype-system="{$doctype-system}" | |
168 saxon:character-representation="{$saxon.character.representa
tion}"> | |
169 <xsl:copy-of select="$content"/> | |
170 </xsl:document> | |
171 </xsl:when> | |
172 <xsl:when test="contains($vendor, 'SAXON')"> | |
173 <!-- Saxon uses saxon:output --> | |
174 <saxon:output file="{$filename}" | |
175 href="{$filename}" | |
176 method="{$method}" | |
177 encoding="{$encoding}" | |
178 indent="{$indent}" | |
179 doctype-public="{$doctype-public}" | |
180 doctype-system="{$doctype-system}" | |
181 saxon:character-representation="{$saxon.character.representa
tion}"> | |
182 <xsl:copy-of select="$content"/> | |
183 </saxon:output> | |
184 </xsl:when> | |
185 <xsl:when test="contains($vendor, 'Apache')"> | |
186 <!-- Xalan uses redirect --> | |
187 <redirect:write file="{$filename}"> | |
188 <xsl:copy-of select="$content"/> | |
189 </redirect:write> | |
190 </xsl:when> | |
191 <xsl:otherwise> | |
192 <!-- it doesn't matter since we won't be making chunks... --> | |
193 <xsl:message terminate="yes"> | |
194 <xsl:text>Can't make chunks with </xsl:text> | |
195 <xsl:value-of select="$vendor"/> | |
196 <xsl:text>'s processor.</xsl:text> | |
197 </xsl:message> | |
198 </xsl:otherwise> | |
199 </xsl:choose> | |
200 </xsl:template> | |
201 | |
202 </xsl:stylesheet> | |
OLD | NEW |