1<?xml version="1.0" encoding="utf-8"?> 2<!-- 3 Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com> 4 5 Distributed under the Boost Software License, Version 1.0. 6 (See accompanying file LICENSE_1_0.txt or copy at 7 http://www.boost.org/LICENSE_1_0.txt) 8 --> 9<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 10 version="1.0"> 11 <xsl:variable name="uppercase-letters" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/> 12 <xsl:variable name="lowercase-letters" select="'abcdefghijklmnopqrstuvwxyz'"/> 13 14 <xsl:key name="classes" match="class|struct|union|typedef" use="@name"/> 15 <xsl:key name="methods" match="method|overloaded-method" use="@name"/> 16 <xsl:key name="functions" match="function|overloaded-function" use="@name"/> 17 <xsl:key name="enums" match="enum" use="@name"/> 18 <xsl:key name="concepts" match="concept" use="@name"/> 19 <xsl:key name="libraries" match="library" use="@name"/> 20 <xsl:key name="macros" match="macro" use="@name"/> 21 <xsl:key name="headers" match="header" use="@name"/> 22 <xsl:key name="globals" match="namespace/data-member|header/data-member" use="@name"/> 23 <xsl:key name="named-entities" 24 match="class|struct|union|concept|function|overloaded-function|macro|library|namespace/data-member|header/data-member|*[attribute::id]" 25 use="translate(@name|@id, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')"/> 26 27 <xsl:template match="function|overloaded-function" mode="generate.id"> 28 <xsl:call-template name="fully-qualified-id"> 29 <xsl:with-param name="node" select="."/> 30 </xsl:call-template> 31 </xsl:template> 32 33 <xsl:template match="classname" mode="annotation"> 34 <!-- Determine the (possibly qualified) class name we are looking for --> 35 <xsl:variable name="fullname"> 36 <xsl:choose> 37 <xsl:when test="@alt"> 38 <xsl:value-of select="@alt"/> 39 </xsl:when> 40 <xsl:otherwise> 41 <xsl:value-of select="string(.)"/> 42 </xsl:otherwise> 43 </xsl:choose> 44 </xsl:variable> 45 46 <!-- Strip off any instantiation --> 47 <xsl:variable name="name"> 48 <xsl:choose> 49 <xsl:when test="contains($fullname, '<')"> 50 <xsl:value-of select="substring-before($fullname, '<')"/> 51 </xsl:when> 52 <xsl:otherwise> 53 <xsl:value-of select="$fullname"/> 54 </xsl:otherwise> 55 </xsl:choose> 56 </xsl:variable> 57 58 <!-- Determine the unqualified name --> 59 <xsl:variable name="unqualified-name"> 60 <xsl:call-template name="strip-qualifiers"> 61 <xsl:with-param name="name" select="$name"/> 62 </xsl:call-template> 63 </xsl:variable> 64 65 <xsl:call-template name="cxx-link-name"> 66 <xsl:with-param name="lookup" select="."/> 67 <xsl:with-param name="type" select="'class'"/> 68 <xsl:with-param name="name" select="$name"/> 69 <xsl:with-param name="display-name" select="string(.)"/> 70 <xsl:with-param name="unqualified-name" select="$unqualified-name"/> 71 <xsl:with-param name="nodes" select="key('classes', $unqualified-name)"/> 72 </xsl:call-template> 73 </xsl:template> 74 75 <xsl:template match="globalname" mode="annotation"> 76 <!-- Determine the (possibly qualified) global name we are looking for --> 77 <xsl:variable name="name"> 78 <xsl:choose> 79 <xsl:when test="@alt"> 80 <xsl:value-of select="@alt"/> 81 </xsl:when> 82 <xsl:otherwise> 83 <xsl:value-of select="string(.)"/> 84 </xsl:otherwise> 85 </xsl:choose> 86 </xsl:variable> 87 88 <!-- Determine the unqualified name --> 89 <xsl:variable name="unqualified-name"> 90 <xsl:call-template name="strip-qualifiers"> 91 <xsl:with-param name="name" select="$name"/> 92 </xsl:call-template> 93 </xsl:variable> 94 95 <xsl:call-template name="cxx-link-name"> 96 <xsl:with-param name="lookup" select="."/> 97 <xsl:with-param name="type" select="'data-member'"/> 98 <xsl:with-param name="name" select="$name"/> 99 <xsl:with-param name="display-name" select="string(.)"/> 100 <xsl:with-param name="unqualified-name" select="$unqualified-name"/> 101 <xsl:with-param name="nodes" select="key('globals', $unqualified-name)"/> 102 </xsl:call-template> 103 </xsl:template> 104 105 <xsl:template match="methodname" mode="annotation"> 106 <!-- Determine the (possibly qualified) method name we are looking for --> 107 <xsl:variable name="fullname"> 108 <xsl:choose> 109 <xsl:when test="@alt"> 110 <xsl:value-of select="@alt"/> 111 </xsl:when> 112 <xsl:otherwise> 113 <xsl:value-of select="string(.)"/> 114 </xsl:otherwise> 115 </xsl:choose> 116 </xsl:variable> 117 118 <!-- Strip off any call --> 119 <xsl:variable name="name"> 120 <xsl:choose> 121 <xsl:when test="contains($fullname, 'operator()')"> 122 <xsl:value-of select="substring-before($fullname, 'operator()')"/> 123 <xsl:value-of select="'operator()'"/> 124 </xsl:when> 125 <xsl:when test="contains($fullname, '(')"> 126 <xsl:value-of select="substring-before($fullname, '(')"/> 127 </xsl:when> 128 <xsl:otherwise> 129 <xsl:value-of select="$fullname"/> 130 </xsl:otherwise> 131 </xsl:choose> 132 </xsl:variable> 133 134 <!-- Determine the unqualified name --> 135 <xsl:variable name="unqualified-name"> 136 <xsl:call-template name="strip-qualifiers"> 137 <xsl:with-param name="name" select="$name"/> 138 </xsl:call-template> 139 </xsl:variable> 140 141 <xsl:call-template name="cxx-link-name"> 142 <xsl:with-param name="lookup" select="."/> 143 <xsl:with-param name="type" select="'method'"/> 144 <xsl:with-param name="name" select="$name"/> 145 <xsl:with-param name="display-name" select="string(.)"/> 146 <xsl:with-param name="unqualified-name" select="$unqualified-name"/> 147 <xsl:with-param name="nodes" select="key('methods', $unqualified-name)"/> 148 </xsl:call-template> 149 </xsl:template> 150 151 <xsl:template match="functionname" mode="annotation"> 152 <!-- Determine the (possibly qualified) function name we are 153 looking for --> 154 <xsl:variable name="fullname"> 155 <xsl:choose> 156 <xsl:when test="@alt"> 157 <xsl:value-of select="@alt"/> 158 </xsl:when> 159 <xsl:otherwise> 160 <xsl:value-of select="string(.)"/> 161 </xsl:otherwise> 162 </xsl:choose> 163 </xsl:variable> 164 165 <!-- Strip off any call --> 166 <xsl:variable name="name"> 167 <xsl:choose> 168 <xsl:when test="contains($fullname, '(')"> 169 <xsl:value-of select="substring-before($fullname, '(')"/> 170 </xsl:when> 171 <xsl:otherwise> 172 <xsl:value-of select="$fullname"/> 173 </xsl:otherwise> 174 </xsl:choose> 175 </xsl:variable> 176 177 <!-- Determine the unqualified name --> 178 <xsl:variable name="unqualified-name"> 179 <xsl:call-template name="strip-qualifiers"> 180 <xsl:with-param name="name" select="$name"/> 181 </xsl:call-template> 182 </xsl:variable> 183 184 <xsl:call-template name="cxx-link-name"> 185 <xsl:with-param name="lookup" select="."/> 186 <xsl:with-param name="type" select="'function'"/> 187 <xsl:with-param name="name" select="$name"/> 188 <xsl:with-param name="display-name" select="string(.)"/> 189 <xsl:with-param name="unqualified-name" select="$unqualified-name"/> 190 <xsl:with-param name="nodes" 191 select="key('functions', $unqualified-name)"/> 192 </xsl:call-template> 193 </xsl:template> 194 195 <xsl:template match="enumname" mode="annotation"> 196 <!-- Determine the (possibly qualified) enum name we are 197 looking for --> 198 <xsl:variable name="fullname"> 199 <xsl:choose> 200 <xsl:when test="@alt"> 201 <xsl:value-of select="@alt"/> 202 </xsl:when> 203 <xsl:otherwise> 204 <xsl:value-of select="string(.)"/> 205 </xsl:otherwise> 206 </xsl:choose> 207 </xsl:variable> 208 209 <!-- Strip off any call --> 210 <xsl:variable name="name"> 211 <xsl:choose> 212 <xsl:when test="contains($fullname, '(')"> 213 <xsl:value-of select="substring-before($fullname, '(')"/> 214 </xsl:when> 215 <xsl:otherwise> 216 <xsl:value-of select="$fullname"/> 217 </xsl:otherwise> 218 </xsl:choose> 219 </xsl:variable> 220 221 <!-- Determine the unqualified name --> 222 <xsl:variable name="unqualified-name"> 223 <xsl:call-template name="strip-qualifiers"> 224 <xsl:with-param name="name" select="$name"/> 225 </xsl:call-template> 226 </xsl:variable> 227 228 <xsl:call-template name="cxx-link-name"> 229 <xsl:with-param name="lookup" select="."/> 230 <xsl:with-param name="type" select="'enum'"/> 231 <xsl:with-param name="name" select="$name"/> 232 <xsl:with-param name="display-name" select="string(.)"/> 233 <xsl:with-param name="unqualified-name" select="$unqualified-name"/> 234 <xsl:with-param name="nodes" 235 select="key('enums', $unqualified-name)"/> 236 </xsl:call-template> 237 </xsl:template> 238 239 <xsl:template match="libraryname" mode="annotation"> 240 <xsl:variable name="name"> 241 <xsl:choose> 242 <xsl:when test="@alt"> 243 <xsl:value-of select="@alt"/> 244 </xsl:when> 245 <xsl:otherwise> 246 <xsl:value-of select="text()"/> 247 </xsl:otherwise> 248 </xsl:choose> 249 </xsl:variable> 250 251 <xsl:variable name="node" select="key('libraries', $name)"/> 252 253 <xsl:choose> 254 <xsl:when test="count($node)=0"> 255 <xsl:message> 256 <xsl:text>warning: Cannot find library '</xsl:text> 257 <xsl:value-of select="$name"/> 258 <xsl:text>'</xsl:text> 259 </xsl:message> 260 <xsl:value-of select="$name"/> 261 </xsl:when> 262 <xsl:otherwise> 263 <xsl:call-template name="library.link"> 264 <xsl:with-param name="node" select="$node"/> 265 <xsl:with-param name="name" select="text()"/> 266 </xsl:call-template> 267 </xsl:otherwise> 268 </xsl:choose> 269 </xsl:template> 270 271 <xsl:template match="conceptname" mode="annotation"> 272 <xsl:param name="name" select="text()"/> 273 274 <xsl:call-template name="concept.link"> 275 <xsl:with-param name="name" select="$name"/> 276 </xsl:call-template> 277 </xsl:template> 278 279 <xsl:template match="macroname" mode="annotation"> 280 <xsl:param name="name"> 281 <xsl:choose> 282 <xsl:when test="@alt"> 283 <xsl:value-of select="@alt"/> 284 </xsl:when> 285 <xsl:otherwise> 286 <xsl:value-of select="string(.)"/> 287 </xsl:otherwise> 288 </xsl:choose> 289 </xsl:param> 290 291 <xsl:variable name="node" select="key('macros', $name)"/> 292 <xsl:choose> 293 <xsl:when test="count($node) = 0"> 294 <xsl:message> 295 <xsl:text>warning: cannot find macro `</xsl:text> 296 <xsl:value-of select="$name"/> 297 <xsl:text>'</xsl:text> 298 </xsl:message> 299 <xsl:value-of select="$name"/> 300 </xsl:when> 301 302 <xsl:when test="count($node) = 1"> 303 <xsl:call-template name="internal-link"> 304 <xsl:with-param name="to"> 305 <xsl:call-template name="generate.id"> 306 <xsl:with-param name="node" select="$node"/> 307 </xsl:call-template> 308 </xsl:with-param> 309 <xsl:with-param name="text" select="string(.)"/> 310 </xsl:call-template> 311 </xsl:when> 312 313 <xsl:otherwise> 314 <xsl:message> 315 <xsl:text>error: macro `</xsl:text> 316 <xsl:value-of select="$name"/> 317 <xsl:text>' is multiply defined.</xsl:text> 318 </xsl:message> 319 <xsl:value-of select="$node"/> 320 </xsl:otherwise> 321 </xsl:choose> 322 </xsl:template> 323 324 <xsl:template match="headername" mode="annotation"> 325 <xsl:variable name="name"> 326 <xsl:choose> 327 <xsl:when test="@alt"> 328 <xsl:value-of select="@alt"/> 329 </xsl:when> 330 <xsl:otherwise> 331 <xsl:value-of select="string(.)"/> 332 </xsl:otherwise> 333 </xsl:choose> 334 </xsl:variable> 335 336 <xsl:variable name="node" select="key('headers', $name)"/> 337 <xsl:choose> 338 <xsl:when test="count($node) = 0"> 339 <xsl:message> 340 <xsl:text>warning: cannot find header `</xsl:text> 341 <xsl:value-of select="$name"/> 342 <xsl:text>'</xsl:text> 343 </xsl:message> 344 <xsl:value-of select="$name"/> 345 </xsl:when> 346 347 <xsl:when test="count($node) = 1"> 348 <xsl:call-template name="internal-link"> 349 <xsl:with-param name="to"> 350 <xsl:call-template name="generate.id"> 351 <xsl:with-param name="node" select="$node"/> 352 </xsl:call-template> 353 </xsl:with-param> 354 <xsl:with-param name="text" select="string(.)"/> 355 </xsl:call-template> 356 </xsl:when> 357 358 <xsl:otherwise> 359 <xsl:message> 360 <xsl:text>error: header `</xsl:text> 361 <xsl:value-of select="$name"/> 362 <xsl:text>' is multiply defined.</xsl:text> 363 </xsl:message> 364 <xsl:value-of select="$node"/> 365 </xsl:otherwise> 366 </xsl:choose> 367 </xsl:template> 368 369 <xsl:template match="text()" mode="annotation"> 370 <xsl:param name="highlight" select="false()"/> 371 <xsl:choose> 372 <xsl:when test="$highlight"> 373 <xsl:call-template name="source-highlight"> 374 <xsl:with-param name="text" select="."/> 375 </xsl:call-template> 376 </xsl:when> 377 <xsl:otherwise> 378 <xsl:copy-of select="."/> 379 </xsl:otherwise> 380 </xsl:choose> 381 </xsl:template> 382 383 <xsl:template match="programlisting" mode="annotation"> 384 <programlisting> 385 <xsl:apply-templates mode="annotation"> 386 <xsl:with-param name="highlight" select="true()"/> 387 </xsl:apply-templates> 388 </programlisting> 389 </xsl:template> 390 391 <xsl:template match="code" mode="annotation"> 392 <computeroutput> 393 <xsl:apply-templates mode="annotation"/> 394 </computeroutput> 395 </xsl:template> 396 397 <xsl:template match="code[@language='jam']" mode="annotation"> 398 <computeroutput> 399 <xsl:apply-templates mode="annotation"/> 400 </computeroutput> 401 </xsl:template> 402 403 <xsl:template match="code[@language='c++']" mode="annotation"> 404 <computeroutput> 405 <xsl:apply-templates mode="annotation"> 406 <xsl:with-param name="highlight" select="true()"/> 407 </xsl:apply-templates> 408 </computeroutput> 409 </xsl:template> 410 411 <xsl:template match="bold" mode="annotation"> 412 <emphasis role="bold"> 413 <xsl:apply-templates mode="annotation"/> 414 </emphasis> 415 </xsl:template> 416 417 <xsl:template match="description" mode="annotation"> 418 <xsl:apply-templates mode="annotation"/> 419 </xsl:template> 420 421 <xsl:template match="type" mode="annotation"> 422 <xsl:apply-templates mode="annotation"/> 423 </xsl:template> 424 425 <xsl:template match="comment()" mode="annotation"> 426 <xsl:copy/> 427 </xsl:template> 428 429 <xsl:template match="node()" mode="annotation"> 430 <xsl:param name="highlight" select="false()"/> 431 432 <xsl:element name="{name(.)}"> 433 <xsl:copy-of select="./@*"/> 434 <xsl:apply-templates select="./*|./text()" mode="annotation"> 435 <xsl:with-param name="highlight" select="$highlight"/> 436 </xsl:apply-templates> 437 </xsl:element> 438 </xsl:template> 439 440 <!-- The "purpose" mode strips simpara/para elements so that we can 441 place the resulting text into a comment in the synopsis. --> 442 <xsl:template match="para|simpara" mode="purpose"> 443 <xsl:apply-templates mode="annotation"/> 444 </xsl:template> 445 446 <xsl:template match="*" mode="purpose"> 447 <xsl:apply-templates select="." mode="annotation"/> 448 </xsl:template> 449 450 <xsl:template match="text()" mode="purpose"> 451 <xsl:apply-templates select="." mode="annotation"/> 452 </xsl:template> 453</xsl:stylesheet> 454