]> git.lyx.org Git - lyx.git/blob - lib/docbook/xhtml/oldchunker.xsl
Use same find-dialogs as other bind-files also for x?emacs
[lyx.git] / lib / docbook / xhtml / oldchunker.xsl
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:d="http://docbook.org/ns/docbook" 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 d" extension-element-prefixes="saxon redirect lxslt">
2
3 <!-- ********************************************************************
4
5      This file is part of the XSL DocBook Stylesheet distribution.
6      See ../README or http://cdn.docbook.org/release/xsl/current/ for
7      copyright and other information.
8
9      ******************************************************************** -->
10
11 <!-- ==================================================================== -->
12
13 <!-- This stylesheet works with Saxon and Xalan; for XT use xtchunker.xsl -->
14
15 <!-- ==================================================================== -->
16
17 <xsl:param name="default.encoding" select="'ISO-8859-1'" doc:type="string"/>
18
19 <doc:param xmlns="" name="default.encoding">
20 <refpurpose xmlns="http://www.w3.org/1999/xhtml">Encoding used in generated HTML pages</refpurpose>
21 <refdescription xmlns="http://www.w3.org/1999/xhtml">
22 <para>This encoding is used in files generated by chunking stylesheet. Currently
23 only Saxon is able to change output encoding.
24 </para>
25 </refdescription>
26 </doc:param>
27
28 <!-- ==================================================================== -->
29
30 <xsl:param name="saxon.character.representation" select="'entity;decimal'" doc:type="string"/>
31
32 <doc:param xmlns="" name="saxon.character.representation">
33 <refpurpose xmlns="http://www.w3.org/1999/xhtml">Saxon character representation used in generated HTML pages</refpurpose>
34 <refdescription xmlns="http://www.w3.org/1999/xhtml">
35 <para>This character representation is used in files generated by chunking stylesheet. If
36 you want to suppress entity references for characters with direct representation 
37 in default.encoding, set this parameter to value <literal>native</literal>. 
38 </para>
39 </refdescription>
40 </doc:param>
41
42 <!-- ==================================================================== -->
43
44 <xsl:template name="make-relative-filename">
45   <xsl:param name="base.dir" select="'./'"/>
46   <xsl:param name="base.name" select="''"/>
47
48   <xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
49
50   <xsl:choose>
51     <xsl:when test="contains($vendor, 'SAXON')">
52       <!-- Saxon doesn't make the chunks relative -->
53       <xsl:value-of select="concat($base.dir,$base.name)"/>
54     </xsl:when>
55     <xsl:when test="contains($vendor, 'Apache')">
56       <!-- Xalan doesn't make the chunks relative -->
57       <xsl:value-of select="concat($base.dir,$base.name)"/>
58     </xsl:when>
59     <xsl:otherwise>
60       <xsl:message terminate="yes">
61         <xsl:text>Chunking isn't supported with </xsl:text>
62         <xsl:value-of select="$vendor"/>
63       </xsl:message>
64     </xsl:otherwise>
65   </xsl:choose>
66 </xsl:template>
67
68 <xsl:template name="write.chunk">
69   <xsl:param name="filename" select="''"/>
70   <xsl:param name="method" select="'html'"/>
71   <xsl:param name="encoding" select="$default.encoding"/>
72   <xsl:param name="indent" select="'no'"/>
73   <xsl:param name="content" select="''"/>
74
75   <xsl:message>
76     <xsl:text>Writing </xsl:text>
77     <xsl:value-of select="$filename"/>
78     <xsl:if test="name(.) != ''">
79       <xsl:text> for </xsl:text>
80       <xsl:value-of select="name(.)"/>
81       <xsl:if test="@id">
82         <xsl:text>(</xsl:text>
83         <xsl:value-of select="@id"/>
84         <xsl:text>)</xsl:text>
85       </xsl:if>
86     </xsl:if>
87   </xsl:message>
88
89   <xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
90
91   <xsl:choose>
92     <xsl:when test="contains($vendor, 'SAXON 6.2')">
93       <!-- Saxon 6.2.x uses xsl:document -->
94       <xsl:document href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" saxon:character-representation="{$saxon.character.representation}">
95         <xsl:copy-of select="$content"/>
96       </xsl:document>
97     </xsl:when>
98     <xsl:when test="contains($vendor, 'SAXON')">
99       <!-- Saxon uses saxon:output -->
100       <saxon:output file="{$filename}" href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" saxon:character-representation="{$saxon.character.representation}">
101         <xsl:copy-of select="$content"/>
102       </saxon:output>
103     </xsl:when>
104     <xsl:when test="contains($vendor, 'Apache')">
105       <!-- Xalan uses redirect -->
106       <redirect:write file="{$filename}">
107         <xsl:copy-of select="$content"/>
108       </redirect:write>
109     </xsl:when>
110     <xsl:otherwise>
111       <!-- it doesn't matter since we won't be making chunks... -->
112       <xsl:message terminate="yes">
113         <xsl:text>Can't make chunks with </xsl:text>
114         <xsl:value-of select="$vendor"/>
115         <xsl:text>'s processor.</xsl:text>
116       </xsl:message>
117     </xsl:otherwise>
118   </xsl:choose>
119 </xsl:template>
120
121 <xsl:template name="write.chunk.with.doctype">
122   <xsl:param name="filename" select="''"/>
123   <xsl:param name="method" select="'html'"/>
124   <xsl:param name="encoding" select="$default.encoding"/>
125   <xsl:param name="indent" select="'no'"/>
126   <xsl:param name="doctype-public" select="''"/>
127   <xsl:param name="doctype-system" select="''"/>
128   <xsl:param name="content" select="''"/>
129
130   <xsl:message>
131     <xsl:text>Writing </xsl:text>
132     <xsl:value-of select="$filename"/>
133     <xsl:if test="name(.) != ''">
134       <xsl:text> for </xsl:text>
135       <xsl:value-of select="name(.)"/>
136     </xsl:if>
137   </xsl:message>
138
139   <xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
140
141   <xsl:choose>
142     <xsl:when test="contains($vendor, 'SAXON 6.2')">
143       <!-- Saxon 6.2.x uses xsl:document -->
144       <xsl:document href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" doctype-public="{$doctype-public}" doctype-system="{$doctype-system}" saxon:character-representation="{$saxon.character.representation}">
145         <xsl:copy-of select="$content"/>
146       </xsl:document>
147     </xsl:when>
148     <xsl:when test="contains($vendor, 'SAXON')">
149       <!-- Saxon uses saxon:output -->
150       <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}">
151         <xsl:copy-of select="$content"/>
152       </saxon:output>
153     </xsl:when>
154     <xsl:when test="contains($vendor, 'Apache')">
155       <!-- Xalan uses redirect -->
156       <redirect:write file="{$filename}">
157         <xsl:copy-of select="$content"/>
158       </redirect:write>
159     </xsl:when>
160     <xsl:otherwise>
161       <!-- it doesn't matter since we won't be making chunks... -->
162       <xsl:message terminate="yes">
163         <xsl:text>Can't make chunks with </xsl:text>
164         <xsl:value-of select="$vendor"/>
165         <xsl:text>'s processor.</xsl:text>
166       </xsl:message>
167     </xsl:otherwise>
168   </xsl:choose>
169 </xsl:template>
170
171 </xsl:stylesheet>