source: clfs-embedded/BOOK/stylesheets/lfs-xsl/docbook-xsl-snapshot/xhtml/pi.xsl@ 14af48c

Last change on this file since 14af48c was 9882b55, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Added the new lfs-xsl stylesheets.

  • Property mode set to 100644
File size: 8.3 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="http://www.w3.org/1999/xhtml" version="1.0">
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<xsl:template match="processing-instruction()">
17</xsl:template>
18
19<xsl:template match="processing-instruction('dbhtml')">
20 <!-- nop -->
21</xsl:template>
22
23<!-- ==================================================================== -->
24
25<xsl:template name="dbhtml-attribute">
26 <xsl:param name="pis" select="processing-instruction('dbhtml')"/>
27 <xsl:param name="attribute">filename</xsl:param>
28
29 <xsl:call-template name="pi-attribute">
30 <xsl:with-param name="pis" select="$pis"/>
31 <xsl:with-param name="attribute" select="$attribute"/>
32 </xsl:call-template>
33</xsl:template>
34
35<xsl:template name="dbhtml-filename">
36 <xsl:param name="pis" select="./processing-instruction('dbhtml')"/>
37 <xsl:call-template name="dbhtml-attribute">
38 <xsl:with-param name="pis" select="$pis"/>
39 <xsl:with-param name="attribute">filename</xsl:with-param>
40 </xsl:call-template>
41</xsl:template>
42
43<!--
44<xsl:template name="dbhtml-dir">
45 <xsl:param name="pis" select="./processing-instruction('dbhtml')"/>
46 <xsl:call-template name="dbhtml-attribute">
47 <xsl:with-param name="pis" select="$pis"/>
48 <xsl:with-param name="attribute">dir</xsl:with-param>
49 </xsl:call-template>
50</xsl:template>
51-->
52
53<xsl:template name="dbhtml-dir">
54 <xsl:param name="context" select="."/>
55
56 <!-- directories are now inherited from previous levels -->
57
58 <xsl:variable name="ppath">
59 <xsl:if test="$context/parent::*">
60 <xsl:call-template name="dbhtml-dir">
61 <xsl:with-param name="context" select="$context/parent::*"/>
62 </xsl:call-template>
63 </xsl:if>
64 </xsl:variable>
65
66 <xsl:variable name="path">
67 <xsl:call-template name="dbhtml-attribute">
68 <xsl:with-param name="pis" select="$context/processing-instruction('dbhtml')"/>
69 <xsl:with-param name="attribute">dir</xsl:with-param>
70 </xsl:call-template>
71 </xsl:variable>
72
73 <xsl:choose>
74 <xsl:when test="$path = ''">
75 <xsl:if test="$ppath != ''">
76 <xsl:value-of select="$ppath"/>
77 </xsl:if>
78 </xsl:when>
79 <xsl:otherwise>
80 <xsl:if test="$ppath != ''">
81 <xsl:value-of select="$ppath"/>
82 <xsl:if test="substring($ppath, string-length($ppath), 1) != '/'">
83 <xsl:text>/</xsl:text>
84 </xsl:if>
85 </xsl:if>
86 <xsl:value-of select="$path"/>
87 <xsl:text>/</xsl:text>
88 </xsl:otherwise>
89 </xsl:choose>
90</xsl:template>
91
92<!-- ==================================================================== -->
93
94<xsl:template name="process.cmdsynopsis.list">
95 <xsl:param name="cmdsynopses"/><!-- empty node list by default -->
96 <xsl:param name="count" select="1"/>
97
98 <xsl:choose>
99 <xsl:when test="$count&gt;count($cmdsynopses)"/>
100 <xsl:otherwise>
101 <xsl:variable name="cmdsyn" select="$cmdsynopses[$count]"/>
102
103 <dt>
104 <a>
105 <xsl:attribute name="href">
106 <xsl:call-template name="object.id">
107 <xsl:with-param name="object" select="$cmdsyn"/>
108 </xsl:call-template>
109 </xsl:attribute>
110
111 <xsl:choose>
112 <xsl:when test="$cmdsyn/@xreflabel">
113 <xsl:call-template name="xref.xreflabel">
114 <xsl:with-param name="target" select="$cmdsyn"/>
115 </xsl:call-template>
116 </xsl:when>
117 <xsl:otherwise>
118 <xsl:apply-templates select="$cmdsyn" mode="xref-to">
119 <xsl:with-param name="target" select="$cmdsyn"/>
120 </xsl:apply-templates>
121 </xsl:otherwise>
122 </xsl:choose>
123 </a>
124 </dt>
125
126 <xsl:call-template name="process.cmdsynopsis.list">
127 <xsl:with-param name="cmdsynopses" select="$cmdsynopses"/>
128 <xsl:with-param name="count" select="$count+1"/>
129 </xsl:call-template>
130 </xsl:otherwise>
131 </xsl:choose>
132</xsl:template>
133
134<xsl:template match="processing-instruction('dbcmdlist')">
135 <xsl:variable name="cmdsynopses" select="..//cmdsynopsis"/>
136
137 <xsl:if test="count($cmdsynopses)&lt;1">
138 <xsl:message><xsl:text>No cmdsynopsis elements matched dbcmdlist PI, perhaps it's nested too deep?</xsl:text>
139 </xsl:message>
140 </xsl:if>
141
142 <dl>
143 <xsl:call-template name="process.cmdsynopsis.list">
144 <xsl:with-param name="cmdsynopses" select="$cmdsynopses"/>
145 </xsl:call-template>
146 </dl>
147</xsl:template>
148
149<!-- ==================================================================== -->
150
151<xsl:template name="process.funcsynopsis.list">
152 <xsl:param name="funcsynopses"/><!-- empty node list by default -->
153 <xsl:param name="count" select="1"/>
154
155 <xsl:choose>
156 <xsl:when test="$count&gt;count($funcsynopses)"/>
157 <xsl:otherwise>
158 <xsl:variable name="cmdsyn" select="$funcsynopses[$count]"/>
159
160 <dt>
161 <a>
162 <xsl:attribute name="href">
163 <xsl:call-template name="object.id">
164 <xsl:with-param name="object" select="$cmdsyn"/>
165 </xsl:call-template>
166 </xsl:attribute>
167
168 <xsl:choose>
169 <xsl:when test="$cmdsyn/@xreflabel">
170 <xsl:call-template name="xref.xreflabel">
171 <xsl:with-param name="target" select="$cmdsyn"/>
172 </xsl:call-template>
173 </xsl:when>
174 <xsl:otherwise>
175 <xsl:apply-templates select="$cmdsyn" mode="xref-to">
176 <xsl:with-param name="target" select="$cmdsyn"/>
177 </xsl:apply-templates>
178 </xsl:otherwise>
179 </xsl:choose>
180 </a>
181 </dt>
182
183 <xsl:call-template name="process.funcsynopsis.list">
184 <xsl:with-param name="funcsynopses" select="$funcsynopses"/>
185 <xsl:with-param name="count" select="$count+1"/>
186 </xsl:call-template>
187 </xsl:otherwise>
188 </xsl:choose>
189</xsl:template>
190
191<xsl:template match="processing-instruction('dbfunclist')">
192 <xsl:variable name="funcsynopses" select="..//funcsynopsis"/>
193
194 <xsl:if test="count($funcsynopses)&lt;1">
195 <xsl:message><xsl:text>No funcsynopsis elements matched dbfunclist PI, perhaps it's nested too deep?</xsl:text>
196 </xsl:message>
197 </xsl:if>
198
199 <dl>
200 <xsl:call-template name="process.funcsynopsis.list">
201 <xsl:with-param name="funcsynopses" select="$funcsynopses"/>
202 </xsl:call-template>
203 </dl>
204</xsl:template>
205
206<!-- ==================================================================== -->
207
208<!-- Copy well-formed external HTML content to the output. -->
209<!-- An optional <html> wrapper will be removed before content is copied
210 to support multiple elements in output without a wrapper.
211 No other processing is done to the content. -->
212<xsl:template match="processing-instruction('dbhtml-include')">
213 <xsl:param name="href">
214 <xsl:call-template name="dbhtml-attribute">
215 <xsl:with-param name="pis" select="."/>
216 <xsl:with-param name="attribute">href</xsl:with-param>
217 </xsl:call-template>
218 </xsl:param>
219
220 <xsl:choose>
221 <xsl:when test="$href != ''">
222 <xsl:variable name="content" select="document($href,/)"/>
223 <xsl:choose>
224 <xsl:when test="$content/*">
225 <xsl:choose>
226 <xsl:when test="$content/*[1][self::html]">
227 <!-- include just the children of html wrapper -->
228 <xsl:copy-of select="$content/*[1]/node()"/>
229 </xsl:when>
230 <xsl:otherwise>
231 <xsl:copy-of select="$content"/>
232 </xsl:otherwise>
233 </xsl:choose>
234 </xsl:when>
235 <xsl:otherwise>
236 <xsl:message>
237 <xsl:text>ERROR: dbhtml-include processing instruction </xsl:text>
238 <xsl:text>href has no content.</xsl:text>
239 </xsl:message>
240 </xsl:otherwise>
241 </xsl:choose>
242 </xsl:when>
243 <xsl:otherwise>
244 <xsl:message>
245 <xsl:text>ERROR: dbhtml-include processing instruction has </xsl:text>
246 <xsl:text>missing or empty href value.</xsl:text>
247 </xsl:message>
248 </xsl:otherwise>
249 </xsl:choose>
250</xsl:template>
251
252</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.