source: BOOK/stylesheets/lfs-xsl/docbook-xsl-snapshot/xhtml/oldchunker.xsl@ 6cc3c3f

clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 6cc3c3f was f8c4e94, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Added LFS XSL Stylesheets.

  • Property mode set to 100644
File size: 7.1 KB
RevLine 
[f8c4e94]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:doc="http://nwalsh.com/xsl/documentation/1.0" xmlns="http://www.w3.org/1999/xhtml" version="1.1" exclude-result-prefixes="doc" extension-element-prefixes="saxon redirect lxslt">
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 Saxon and Xalan; for XT use xtchunker.xsl -->
19
20<!-- ==================================================================== -->
21
22<xsl:param name="default.encoding" select="'ISO-8859-1'" doc:type="string"/>
23
24<doc:param xmlns="" name="default.encoding">
25<refpurpose xmlns="http://www.w3.org/1999/xhtml">Encoding used in generated HTML pages</refpurpose>
26<refdescription xmlns="http://www.w3.org/1999/xhtml">
27<para>This encoding is used in files generated by chunking stylesheet. Currently
28only Saxon is able to change output encoding.
29</para>
30</refdescription>
31</doc:param>
32
33<!-- ==================================================================== -->
34
35<xsl:param name="saxon.character.representation" select="'entity;decimal'" doc:type="string"/>
36
37<doc:param xmlns="" name="saxon.character.representation">
38<refpurpose xmlns="http://www.w3.org/1999/xhtml">Saxon character representation used in generated HTML pages</refpurpose>
39<refdescription xmlns="http://www.w3.org/1999/xhtml">
40<para>This character representation is used in files generated by chunking stylesheet. If
41you want to suppress entity references for characters with direct representation
42in default.encoding, set this parameter to value <literal>native</literal>.
43</para>
44</refdescription>
45</doc:param>
46
47<!-- ==================================================================== -->
48
49<xsl:template name="make-relative-filename">
50 <xsl:param name="base.dir" select="'./'"/>
51 <xsl:param name="base.name" select="''"/>
52
53 <xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
54
55 <xsl:choose>
56 <xsl:when test="contains($vendor, 'SAXON')">
57 <!-- Saxon doesn't make the chunks relative -->
58 <xsl:value-of select="concat($base.dir,$base.name)"/>
59 </xsl:when>
60 <xsl:when test="contains($vendor, 'Apache')">
61 <!-- Xalan doesn't make the chunks relative -->
62 <xsl:value-of select="concat($base.dir,$base.name)"/>
63 </xsl:when>
64 <xsl:otherwise>
65 <xsl:message terminate="yes">
66 <xsl:text>Chunking isn't supported with </xsl:text>
67 <xsl:value-of select="$vendor"/>
68 </xsl:message>
69 </xsl:otherwise>
70 </xsl:choose>
71</xsl:template>
72
73<xsl:template name="write.chunk">
74 <xsl:param name="filename" select="''"/>
75 <xsl:param name="method" select="'html'"/>
76 <xsl:param name="encoding" select="$default.encoding"/>
77 <xsl:param name="indent" select="'no'"/>
78 <xsl:param name="content" select="''"/>
79
80 <xsl:message>
81 <xsl:text>Writing </xsl:text>
82 <xsl:value-of select="$filename"/>
83 <xsl:if test="name(.) != ''">
84 <xsl:text> for </xsl:text>
85 <xsl:value-of select="name(.)"/>
86 <xsl:if test="@id">
87 <xsl:text>(</xsl:text>
88 <xsl:value-of select="@id"/>
89 <xsl:text>)</xsl:text>
90 </xsl:if>
91 </xsl:if>
92 </xsl:message>
93
94 <xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
95
96 <xsl:choose>
97 <xsl:when test="contains($vendor, 'SAXON 6.2')">
98 <!-- Saxon 6.2.x uses xsl:document -->
99 <xsl:document href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" saxon:character-representation="{$saxon.character.representation}">
100 <xsl:copy-of select="$content"/>
101 </xsl:document>
102 </xsl:when>
103 <xsl:when test="contains($vendor, 'SAXON')">
104 <!-- Saxon uses saxon:output -->
105 <saxon:output file="{$filename}" href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" saxon:character-representation="{$saxon.character.representation}">
106 <xsl:copy-of select="$content"/>
107 </saxon:output>
108 </xsl:when>
109 <xsl:when test="contains($vendor, 'Apache')">
110 <!-- Xalan uses redirect -->
111 <redirect:write file="{$filename}">
112 <xsl:copy-of select="$content"/>
113 </redirect:write>
114 </xsl:when>
115 <xsl:otherwise>
116 <!-- it doesn't matter since we won't be making chunks... -->
117 <xsl:message terminate="yes">
118 <xsl:text>Can't make chunks with </xsl:text>
119 <xsl:value-of select="$vendor"/>
120 <xsl:text>'s processor.</xsl:text>
121 </xsl:message>
122 </xsl:otherwise>
123 </xsl:choose>
124</xsl:template>
125
126<xsl:template name="write.chunk.with.doctype">
127 <xsl:param name="filename" select="''"/>
128 <xsl:param name="method" select="'html'"/>
129 <xsl:param name="encoding" select="$default.encoding"/>
130 <xsl:param name="indent" select="'no'"/>
131 <xsl:param name="doctype-public" select="''"/>
132 <xsl:param name="doctype-system" select="''"/>
133 <xsl:param name="content" select="''"/>
134
135 <xsl:message>
136 <xsl:text>Writing </xsl:text>
137 <xsl:value-of select="$filename"/>
138 <xsl:if test="name(.) != ''">
139 <xsl:text> for </xsl:text>
140 <xsl:value-of select="name(.)"/>
141 </xsl:if>
142 </xsl:message>
143
144 <xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
145
146 <xsl:choose>
147 <xsl:when test="contains($vendor, 'SAXON 6.2')">
148 <!-- Saxon 6.2.x uses xsl:document -->
149 <xsl:document href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" doctype-public="{$doctype-public}" doctype-system="{$doctype-system}" saxon:character-representation="{$saxon.character.representation}">
150 <xsl:copy-of select="$content"/>
151 </xsl:document>
152 </xsl:when>
153 <xsl:when test="contains($vendor, 'SAXON')">
154 <!-- Saxon uses saxon:output -->
155 <saxon:output file="{$filename}" href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" doctype-public="{$doctype-public}" doctype-system="{$doctype-system}" saxon:character-representation="{$saxon.character.representation}">
156 <xsl:copy-of select="$content"/>
157 </saxon:output>
158 </xsl:when>
159 <xsl:when test="contains($vendor, 'Apache')">
160 <!-- Xalan uses redirect -->
161 <redirect:write file="{$filename}">
162 <xsl:copy-of select="$content"/>
163 </redirect:write>
164 </xsl:when>
165 <xsl:otherwise>
166 <!-- it doesn't matter since we won't be making chunks... -->
167 <xsl:message terminate="yes">
168 <xsl:text>Can't make chunks with </xsl:text>
169 <xsl:value-of select="$vendor"/>
170 <xsl:text>'s processor.</xsl:text>
171 </xsl:message>
172 </xsl:otherwise>
173 </xsl:choose>
174</xsl:template>
175
176</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.