Debian Codegraph @

xhtml/opencl-man.xsl

raw symbols SCIP
1 <?xml version='1.0'?>
2
3
4 <xsl:stylesheet
5 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
6 xmlns:xlink="http://www.w3.org/1999/xlink"
7 version="1.0">
8
9
10 <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"/>
11
12 <!-- This file contains the "customization layer" for the Docbook system. When a Docbook rule
13 doesn't do exactly what we need, we override the rule in this file with a modified rule. -->
14
15 <!-- Inserts the file style-css.xsl. This is embeddd into the <head /> tag of each resulting html file -->
16 <xsl:include href="styles-css.xsl" />
17 <xsl:include href="copyright.inc.xsl" />
18 <xsl:param name="funcsynopsis.style">ansi</xsl:param>
19 <xsl:param name="citerefentry.link" select="'1'"></xsl:param>
20 <xsl:template name="generate.html.title" />
21 <xsl:output indent="yes"/>
22
23 <!-- Set this param to a placeholder for the base URL of the external specification document. Include
24 the beginning of the 'namedest' function as well. See the script pageNumberLookup.rb to see
25 how this placeholder gets replaced by the actual spec URL and target page number. This placeholder
26 can be any string, and only needs to match the same placeholder string in pageNumberLookup.rb. -->
27 <xsl:param name="SpecBaseUrl">http://www.khronos.org/registry/cl/specs/opencl-1.x-latest.pdf#namedest=</xsl:param>
28
29 <!-- This generates a URL based on the contents of Refentry title. However if there is a value
30 specified for the href attribute in Citerefentry, then it will create the URL out if that content instead -->
31 <xsl:template name="generate.citerefentry.link">
32 <xsl:choose>
33 <xsl:when test="@href">
34 <xsl:value-of select="@href"/>
35 <xsl:text>.html</xsl:text>
36 </xsl:when>
37 <xsl:otherwise>
38 <xsl:value-of select="refentrytitle"/>
39 <xsl:text>.html</xsl:text>
40 </xsl:otherwise>
41 </xsl:choose>
42 </xsl:template>
43
44 <!-- The following template creates the link for the Specification section -->
45 <xsl:template match="olink">
46 <xsl:text disable-output-escaping="yes">&lt;a href="</xsl:text>
47 <xsl:value-of select="$SpecBaseUrl" />
48 <xsl:value-of select="@uri" />
49 <xsl:text disable-output-escaping="yes">" target="OpenCL Spec"&gt;</xsl:text>
50 <xsl:value-of select="." />
51 <xsl:text disable-output-escaping="yes">&lt;/a&gt;</xsl:text>
52 </xsl:template>
53
54 <!-- The following enables use of ulink for regular URLs on the pages-->
55 <xsl:template match="ulink">
56 <xsl:text disable-output-escaping="yes">&lt;a href="</xsl:text>
57 <xsl:value-of select="@url" />
58 <xsl:text disable-output-escaping="yes">"&gt;</xsl:text>
59 <xsl:value-of select="." />
60 <xsl:text disable-output-escaping="yes">&lt;/a&gt;</xsl:text>
61 </xsl:template>
62
63
64 <!-- The following is the main set of templates for generating the web pages -->
65 <xsl:template match="*" mode="process.root">
66 <xsl:variable name="doc" select="self::*"/>
67 <xsl:call-template name="user.preroot"/>
68 <xsl:call-template name="root.messages"/>
69
70 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:pref="http://www.w3.org/2002/Math/preference" pref:renderer="mathplayer-dl">
71
72 <head>
73 <xsl:call-template name="system.head.content">
74 <xsl:with-param name="node" select="$doc"/>
75 </xsl:call-template>
76
77 <xsl:call-template name="head.content">
78 <xsl:with-param name="node" select="$doc"/>
79 </xsl:call-template>
80
81 <xsl:call-template name="user.head.content">
82 <xsl:with-param name="node" select="$doc"/>
83 </xsl:call-template>
84 </head>
85
86 <body>
87 <xsl:call-template name="body.attributes"/>
88 <xsl:call-template name="user.header.content">
89 <xsl:with-param name="node" select="$doc"/>
90 </xsl:call-template>
91 <xsl:apply-templates select="."/> <!-- This line performs the magic! -->
92 <xsl:call-template name="user.footer.content">
93 <xsl:with-param name="node" select="$doc"/>
94 </xsl:call-template>
95
96 </body>
97 </html>
98 </xsl:template>
99
100
101 <xsl:template match="/">
102 <xsl:processing-instruction name="xml-stylesheet">
103 <xsl:text>type="text/xsl" href="mathml.xsl"</xsl:text>
104 </xsl:processing-instruction>
105 <xsl:apply-imports/>
106 </xsl:template>
107
108
109 <xsl:template match="funcdef/replaceable">
110 <xsl:call-template name="inline.italicseq"/>
111 </xsl:template>
112
113
114 <!-- This inserts the style-css.xsl file into the HTML file -->
115 <xsl:template name="system.head.content">
116 <xsl:param name="node" select="."/>
117 <style type="text/css">
118 <xsl:value-of select="$annotation.css"/>
119 </style>
120 </xsl:template>
121
122
123 <!-- The templates gentext-refname and refnamediv are inserted here so
124 we can have the refname displayed as the H1 header on the page -->
125 <xsl:template name="gentext-refname">
126 <xsl:param name="key" select="local-name(.)"/>
127 <xsl:param name="lang">
128 <xsl:call-template name="l10n.language"/>
129 </xsl:param>
130 <xsl:value-of select="refname"/>
131 </xsl:template>
132
133 <xsl:template match="refnamediv">
134 <div class="{name(.)}">
135 <xsl:call-template name="anchor"/>
136 <xsl:choose>
137 <xsl:when test="preceding-sibling::refnamediv">
138 <!-- no title on secondary refnamedivs! -->
139 </xsl:when>
140 <xsl:when test="$refentry.generate.name != 0">
141 <h1>
142 <xsl:call-template name="gentext-refname">
143 <xsl:with-param name="key" select="'RefName'"/>
144 </xsl:call-template>
145 </h1>
146 </xsl:when>
147 <xsl:when test="$refentry.generate.title != 0">
148 <h2>
149 <xsl:choose>
150 <xsl:when test="../refmeta/refentrytitle">
151 <xsl:apply-templates select="../refmeta/refentrytitle"/>
152 </xsl:when>
153 <xsl:otherwise>
154 <xsl:apply-templates select="refname[1]"/>
155 </xsl:otherwise>
156 </xsl:choose>
157 </h2>
158 </xsl:when>
159 </xsl:choose>
160 <p>
161 <xsl:apply-templates/>
162 </p>
163 </div>
164 </xsl:template>
165
166
167 <!-- The templates refname and refpurpose are inserted here so that we can
168 modify the layout of these values on the HTML page -->
169 <xsl:template match="refname" />
170 <xsl:template match="refpurpose">
171 <xsl:apply-templates/>
172 </xsl:template>
173
174
175 <!-- The Link template allows us to embed links in the <funcprototype>,
176 even though this is not valid DocBook markup -->
177 <xsl:template match="link" mode="ansi-tabular">
178 <xsl:apply-templates select="."/>
179 </xsl:template>
180
181
182 <!-- The following template enables the <replaceable> tag inside
183 <funcdef>, <paramdef>, and <function> to generate <em> in the HTML output -->
184 <xsl:template match="funcdef/replaceable" mode="ansi-tabular">
185 <xsl:call-template name="inline.italicseq"/>
186 </xsl:template>
187
188 <xsl:template match="paramdef/replaceable" mode="ansi-tabular">
189 <xsl:call-template name="inline.italicseq"/>
190 </xsl:template>
191
192 <xsl:template match="function/replaceable" mode="ansi-nontabular">
193 <xsl:call-template name="inline.italicseq"/>
194 </xsl:template>
195
196 <xsl:template match="refname/replaceable" mode="kr-nontabular">
197 <xsl:call-template name="inline.italicseq"/>
198 </xsl:template>
199
200 <!-- The templates funcprototype and paramdef are here so we can modify the layout
201 of the synopsis so that it is not broken into so many columns in the table, control indenting, and more. -->
202
203 <!-- funcprototype: ansi, tabular -->
204
205 <xsl:template match="funcprototype" mode="ansi-tabular">
206 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0">
207 <xsl:if test="following-sibling::funcprototype">
208 <xsl:attribute name="style">padding-bottom: 1em</xsl:attribute>
209 </xsl:if>
210 <tr valign="bottom">
211 <td>
212 <xsl:apply-templates select="funcdef" mode="ansi-tabular"/>
213 <xsl:apply-templates select="(void|varargs|paramdef)[1]" mode="ansi-tabular"/>
214 </td>
215 </tr>
216 <xsl:for-each select="(void|varargs|paramdef)[position() &gt; 1]">
217 <tr valign="top">
218 <td>&#160;</td>
219 <xsl:apply-templates select="." mode="ansi-tabular"/>
220 </tr>
221 </xsl:for-each>
222 </table>
223 </xsl:template>
224
225
226 <xsl:template match="paramdef" mode="ansi-tabular">
227 <xsl:choose>
228 <xsl:when test="type and funcparams">
229 <td>
230 <xsl:apply-templates select="type" mode="kr-tabular-funcsynopsis-mode"/>
231 <xsl:text>&#160;</xsl:text>
232 </td>
233 <td>
234 <xsl:apply-templates select="type/following-sibling::node()" mode="kr-tabular-funcsynopsis-mode"/>
235 </td>
236 </xsl:when>
237 <xsl:otherwise>
238 <td>
239 <xsl:apply-templates select="parameter/preceding-sibling::node()[not(self::parameter)]" mode="ansi-tabular"/>
240 <xsl:text>&#160;</xsl:text>
241 <!-- </td>
242 <td>-->
243 <xsl:apply-templates select="parameter" mode="ansi-tabular"/>
244 <xsl:apply-templates select="parameter/following-sibling::node()[not(self::parameter)]" mode="ansi-tabular"/>
245 <xsl:choose>
246 <xsl:when test="following-sibling::*">
247 <xsl:text>, </xsl:text>
248 </xsl:when>
249 <xsl:otherwise>
250 <code>)</code>
251 <!-- OpenCL functions do not end with a semi-colon.
252 <xsl:text>;</xsl:text> -->
253 </xsl:otherwise>
254 </xsl:choose>
255 </td>
256 </xsl:otherwise>
257 </xsl:choose>
258 </xsl:template>
259
260
261
262
263 <!-- The template refsect3 is inserted here to deal with the copyright. This
264 adds in the text from the include file copyright.inc.xsl -->
265 <xsl:template match="refsect3">
266 <div class="{name(.)}">
267 <xsl:call-template name="language.attribute"/>
268 <xsl:call-template name="anchor">
269 <xsl:with-param name="conditional" select="0"/>
270 </xsl:call-template>
271 <xsl:apply-templates/>
272 <xsl:value-of select="$copyright"/>
273 </div>
274 </xsl:template>
275 </xsl:stylesheet>