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