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"
7 exclude-result-prefixes="doc"
8 extension-element-prefixes="saxon redirect lxslt">
10 <!-- ********************************************************************
11 $Id: oldchunker.xsl 6910 2007-06-28 23:23:30Z xmldoc $
12 ********************************************************************
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.
18 ******************************************************************** -->
20 <!-- ==================================================================== -->
22 <!-- This stylesheet works with Saxon and Xalan; for XT use xtchunker.xsl -->
24 <!-- ==================================================================== -->
26 <xsl:param name="default.encoding" select="'ISO-8859-1'" doc:type='string'/>
28 <doc:param name="default.encoding" xmlns="">
29 <refpurpose>Encoding used in generated HTML pages</refpurpose>
31 <para>This encoding is used in files generated by chunking stylesheet. Currently
32 only Saxon is able to change output encoding.
37 <!-- ==================================================================== -->
39 <xsl:param name="saxon.character.representation" select="'entity;decimal'" doc:type='string'/>
41 <doc:param name="saxon.character.representation" xmlns="">
42 <refpurpose>Saxon character representation used in generated HTML pages</refpurpose>
44 <para>This character representation is used in files generated by chunking stylesheet. 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>.
51 <!-- ==================================================================== -->
53 <xsl:template name="make-relative-filename">
54 <xsl:param name="base.dir" select="'./'"/>
55 <xsl:param name="base.name" select="''"/>
57 <xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
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)"/>
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)"/>
69 <xsl:message terminate="yes">
70 <xsl:text>Chunking isn't supported with </xsl:text>
71 <xsl:value-of select="$vendor"/>
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="''"/>
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(.)"/>
91 <xsl:text>(</xsl:text>
92 <xsl:value-of select="@id"/>
93 <xsl:text>)</xsl:text>
98 <xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
101 <xsl:when test="contains($vendor, 'SAXON 6.2')">
102 <!-- Saxon 6.2.x uses xsl:document -->
103 <xsl:document href="{$filename}"
105 encoding="{$encoding}"
107 saxon:character-representation="{$saxon.character.representation}">
108 <xsl:copy-of select="$content"/>
111 <xsl:when test="contains($vendor, 'SAXON')">
112 <!-- Saxon uses saxon:output -->
113 <saxon:output file="{$filename}"
116 encoding="{$encoding}"
118 saxon:character-representation="{$saxon.character.representation}">
119 <xsl:copy-of select="$content"/>
122 <xsl:when test="contains($vendor, 'Apache')">
123 <!-- Xalan uses redirect -->
124 <redirect:write file="{$filename}">
125 <xsl:copy-of select="$content"/>
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>
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="''"/>
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(.)"/>
157 <xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
160 <xsl:when test="contains($vendor, 'SAXON 6.2')">
161 <!-- Saxon 6.2.x uses xsl:document -->
162 <xsl:document href="{$filename}"
164 encoding="{$encoding}"
166 doctype-public="{$doctype-public}"
167 doctype-system="{$doctype-system}"
168 saxon:character-representation="{$saxon.character.representation}">
169 <xsl:copy-of select="$content"/>
172 <xsl:when test="contains($vendor, 'SAXON')">
173 <!-- Saxon uses saxon:output -->
174 <saxon:output file="{$filename}"
177 encoding="{$encoding}"
179 doctype-public="{$doctype-public}"
180 doctype-system="{$doctype-system}"
181 saxon:character-representation="{$saxon.character.representation}">
182 <xsl:copy-of select="$content"/>
185 <xsl:when test="contains($vendor, 'Apache')">
186 <!-- Xalan uses redirect -->
187 <redirect:write file="{$filename}">
188 <xsl:copy-of select="$content"/>
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>