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