1<?xml version="1.0" ?> 2 3<!-- 4Copyright (c) 2002-2003 The Trustees of Indiana University. 5 All rights reserved. 6Copyright (c) 2000-2001 University of Notre Dame. All rights reserved. 7 8 Distributed under the Boost Software License, Version 1.0. 9 (See accompanying file LICENSE_1_0.txt or copy at 10 http://www.boost.org/LICENSE_1_0.txt) 11--> 12 13<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> 14 <xsl:strip-space elements="* xsl:*"/> 15 16 <xsl:include href="unparser.xsl"/> 17 18 <xsl:key name="concepts" match="concept" use="@name"/> 19 20 <!-- The layout type to use for concept descriptions. Can be one of: 21 sgi: simulate the SGI STL documentation 22 austern: simulate the documentation in Generic Programming and the STL, 23 by Matthew H. Austern 24 caramel: simulate the formatting from Caramel 25 --> 26 <xsl:param name="boost.concept.layout" select="'austern'"/> 27 28 <xsl:template match="concept"> 29 <refentry> 30 <xsl:attribute name="id"> 31 <xsl:call-template name="generate.id"/> 32 </xsl:attribute> 33 34 <refmeta> 35 <refentrytitle>Concept <xsl:value-of select="@name"/></refentrytitle> 36 <manvolnum>7</manvolnum> 37 </refmeta> 38 39 <refnamediv> 40 <refname><xsl:value-of select="@name"/></refname> 41 <xsl:if test="purpose"> 42 <refpurpose> 43 <xsl:apply-templates select="purpose/*|purpose/text()"/> 44 </refpurpose> 45 </xsl:if> 46 </refnamediv> 47 48 <!-- 49 <refentryinfo> 50 <xsl:for-each select="copyright | copyright-include | legalnotice"> 51 <xsl:choose> 52 <xsl:when test="name(.)='copyright'"> 53 <copyright><xsl:copy-of select="./node()"/></copyright> 54 </xsl:when> 55 <xsl:when test="name(.)='legalnotice'"> 56 <legalnotice><xsl:copy-of select="./node()"/></legalnotice> 57 </xsl:when> 58 <xsl:when test="name(.)='copyright-include'"> 59 <copyright><xsl:copy-of select="document(concat('../concepts/', @file))/copyright/node()"/></copyright> 60 </xsl:when> 61 </xsl:choose> 62 </xsl:for-each> 63 </refentryinfo> 64--> 65 66 <xsl:if test="description"> 67 <xsl:if test="description"> 68 <refsect1> 69 <title>Description</title> 70 <xsl:for-each select="description"> 71 <xsl:apply-templates/> 72 </xsl:for-each> 73 </refsect1> 74 </xsl:if> 75 </xsl:if> 76 77 <xsl:if test="refines | refines-when-mutable"> 78 <refsect1> 79 <title>Refinement of</title> 80 <itemizedlist> 81 <xsl:if test="refines"> 82 <xsl:for-each select="refines"> 83 <listitem> 84 <para> 85 <xsl:call-template name="concept.link"> 86 <xsl:with-param name="name" select="@concept"/> 87 </xsl:call-template> 88 </para> 89 </listitem> 90 </xsl:for-each> 91 </xsl:if> 92 <xsl:if test="refines-when-mutable"> 93 <xsl:for-each select="refines-when-mutable"> 94 <listitem> 95 <para> 96 <xsl:text>When mutable: </xsl:text> 97 <xsl:call-template name="concept.link"> 98 <xsl:with-param name="name" select="@concept"/> 99 </xsl:call-template> 100 </para> 101 </listitem> 102 </xsl:for-each> 103 </xsl:if> 104 </itemizedlist> 105 </refsect1> 106 </xsl:if> 107 108 <!-- This part must be run even if there are no associated types to print out, so the hidden type definitions can be found --> 109 <xsl:variable name="definition_list"> 110 <xsl:call-template name="make-definition-list"> 111 <xsl:with-param name="typedefs" select="define-type | associated-type"/> 112 <xsl:with-param name="definition_list"> 113 <xsl:for-each select="param/@name"> 114 @(@<xsl:value-of select="."/>=<xsl:value-of select="."/>@)@ 115 </xsl:for-each> 116 </xsl:with-param> 117 </xsl:call-template> 118 </xsl:variable> 119 120 <!-- <xsl:message>Definition list: <xsl:value-of select="$definition_list"/></xsl:message> --> 121 122 <xsl:call-template name="print-associated-types"> 123 <xsl:with-param name="typedefs" select="associated-type"/> 124 <xsl:with-param name="definition_list" select="$definition_list"/> 125 </xsl:call-template> 126 127 <xsl:call-template name="concept.notation"> 128 <xsl:with-param name="definition_list" select="$definition_list"/> 129 </xsl:call-template> 130 131 <xsl:variable name="notations"> 132 <xsl:for-each select="notation"> 133 @@(@@<xsl:call-template name="unparse-cpp"> 134 <xsl:with-param name="typeref" select="*[1]"/> 135 <xsl:with-param name="definition_list" select="$definition_list"/> 136 <xsl:with-param name="ignore-cv" select="true()"/> 137 <xsl:with-param name="ignore-references" select="true()"/> 138 </xsl:call-template>@@=@@<xsl:value-of select="normalize-space(@variables)"/>@@)@@ 139 </xsl:for-each> 140 </xsl:variable> 141 142 <!-- <xsl:message>Notations: <xsl:value-of select="normalize-space($notations)"/> End notations</xsl:message> --> 143 144 <xsl:if test="definition"> 145 <refsect1> 146 <title>Definitions</title> 147 <xsl:for-each select="definition"> 148 <p><xsl:apply-templates/></p> 149 </xsl:for-each> 150 </refsect1> 151 </xsl:if> 152 153 <xsl:if test="valid-type-expression | models | models-when-mutable"> 154 <refsect1> 155 <title>Type expressions</title> 156 <variablelist> 157 <xsl:for-each select="models"> 158 <varlistentry> 159 <term/> 160 <listitem> 161 <para> 162 <xsl:call-template name="unparse-operator-definition"> 163 <xsl:with-param name="typeref" select="."/> 164 <xsl:with-param name="operator_nodeset" select="key('concepts', @concept)/models-sentence/node()"/> 165 <xsl:with-param name="definition_list" select="$definition_list"/> 166 <xsl:with-param name="notations" select="$notations"/> 167 <xsl:with-param name="ignore-cv" select="false()"/> 168 <xsl:with-param name="self" select="@concept"/> 169 <xsl:with-param name="use-code-block" select="true()"/> 170 </xsl:call-template> 171 </para> 172 </listitem> 173 </varlistentry> 174 </xsl:for-each> 175 <xsl:for-each select="models-when-mutable"> 176 <varlistentry> 177 <term>Only when mutable</term> 178 <listitem> 179 <para> 180 <xsl:call-template name="unparse-operator-definition"> 181 <xsl:with-param name="typeref" select="."/> 182 <xsl:with-param name="operator_nodeset" select="key('concepts', @concept)/models-sentence/node()"/> 183 <xsl:with-param name="definition_list" select="$definition_list"/> 184 <xsl:with-param name="notations" select="$notations"/> 185 <xsl:with-param name="ignore-cv" select="false()"/> 186 <xsl:with-param name="self" select="@concept"/> 187 <xsl:with-param name="use-code-block" select="true()"/> 188 </xsl:call-template> 189 </para> 190 </listitem> 191 </varlistentry> 192 </xsl:for-each> 193 <xsl:for-each select="valid-type-expression"> 194 <varlistentry> 195 <term><xsl:value-of select="@name"/></term> 196 <listitem> 197 <para> 198 <type> 199 <xsl:call-template name="unparse-cpp"> 200 <xsl:with-param name="typeref" select="*[2]"/> 201 <xsl:with-param name="definition_list" select="$definition_list"/> 202 <xsl:with-param name="notations" select="normalize-space($notations)"/> 203 </xsl:call-template> 204 </type> 205 206 <xsl:comment/> must be 207 <xsl:for-each select="return-type/*"> 208 <xsl:if test="position()!=1 and last()!=2">, </xsl:if> 209 <xsl:if test="position()=last() and last()!=1"> and </xsl:if> 210 <xsl:call-template name="unparse-constraint"> 211 <xsl:with-param name="constraint" select="."/> 212 <xsl:with-param name="definition_list" select="$definition_list"/> 213 <xsl:with-param name="type-expr-mode" select="true()"/> 214 </xsl:call-template> 215 </xsl:for-each><xsl:comment/>. 216 </para> 217 218 <xsl:if test="description"> 219 <xsl:for-each select="description"> 220 <xsl:apply-templates/> 221 </xsl:for-each> 222 </xsl:if> 223 </listitem> 224 </varlistentry> 225 </xsl:for-each> 226 </variablelist> 227 </refsect1> 228 </xsl:if> 229 230 <xsl:if test="valid-expression"> 231 <refsect1> 232 <title>Valid expressions</title> 233 234 <xsl:variable name="columns"> 235 <xsl:if test="valid-expression/return-type"> 236 <xsl:text>T</xsl:text> 237 </xsl:if> 238 <xsl:if test="valid-expression/precondition"> 239 <xsl:text>P</xsl:text> 240 </xsl:if> 241 <xsl:if test="valid-expression/semantics"> 242 <xsl:text>S</xsl:text> 243 </xsl:if> 244 <xsl:if test="valid-expression/postcondition"> 245 <xsl:text>O</xsl:text> 246 </xsl:if> 247 </xsl:variable> 248 249 <informaltable> 250 <tgroup> 251 <xsl:attribute name="cols"> 252 <xsl:value-of select="string-length($columns) + 2"/> 253 </xsl:attribute> 254 <thead> 255 <row> 256 <entry>Name</entry> 257 <entry>Expression</entry> 258 <xsl:if test="contains($columns, 'T')"> 259 <entry>Type</entry> 260 </xsl:if> 261 <xsl:if test="contains($columns, 'P')"> 262 <entry>Precondition</entry> 263 </xsl:if> 264 <xsl:if test="contains($columns, 'S')"> 265 <entry>Semantics</entry> 266 </xsl:if> 267 <xsl:if test="contains($columns, 'O')"> 268 <entry>Postcondition</entry> 269 </xsl:if> 270 </row> 271 </thead> 272 <tbody> 273 <xsl:apply-templates select="valid-expression"> 274 <xsl:with-param name="definition_list" 275 select="$definition_list"/> 276 <xsl:with-param name="notations" 277 select="normalize-space($notations)"/> 278 <xsl:with-param name="columns" select="$columns"/> 279 </xsl:apply-templates> 280 </tbody> 281 </tgroup> 282 </informaltable> 283 <!-- Doug prefers the table 284 <variablelist> 285 <xsl:for-each select="valid-expression"> 286 <xsl:variable name="as-cxx-value"> 287 <xsl:call-template name="unparse-cpp"> 288 <xsl:with-param name="typeref" select="*[1]"/> 289 <xsl:with-param name="definition_list" select="$definition_list"/> 290 <xsl:with-param name="notations" select="normalize-space($notations)"/> 291 </xsl:call-template> 292 </xsl:variable> 293 <varlistentry> 294 <term><xsl:value-of select="@name"/>: <literal><xsl:value-of select="$as-cxx-value"/></literal></term> 295 <listitem><variablelist> 296 <xsl:if test="return-type/*"> 297 <varlistentry><term>Return value</term><listitem><para> 298 <xsl:for-each select="return-type/*"> 299 <xsl:if test="position()!=1 and last()!=2">, </xsl:if> 300 <xsl:if test="position()=last() and last()!=1"> and </xsl:if> 301 <xsl:call-template name="unparse-constraint"> 302 <xsl:with-param name="constraint" select="."/> 303 <xsl:with-param name="definition_list" select="$definition_list"/> 304 <xsl:with-param name="capitalize" select="position()=1"/> 305 </xsl:call-template> 306 </xsl:for-each> 307 </para></listitem></varlistentry> 308 </xsl:if> 309 310 <xsl:for-each select="precondition"> 311 <varlistentry><term>Precondition</term><listitem><para> 312 <xsl:apply-templates/> 313 </para></listitem></varlistentry> 314 </xsl:for-each> 315 316 <xsl:for-each select="semantics"> 317 <varlistentry><term>Semantics</term><listitem><para> 318 <xsl:apply-templates/> 319 </para></listitem></varlistentry> 320 </xsl:for-each> 321 322 <xsl:for-each select="postcondition"> 323 <varlistentry><term>Postcondition</term><listitem><para> 324 <xsl:apply-templates/> 325 </para></listitem></varlistentry> 326 </xsl:for-each> 327 328 </variablelist></listitem> 329 </varlistentry> 330 331 </xsl:for-each> 332 </variablelist> 333--> 334 </refsect1> 335 </xsl:if> 336 337 <xsl:if test="complexity"> 338 <refsect1> 339 <title>Complexity</title> 340 <xsl:for-each select="complexity"> 341 <para><xsl:apply-templates/></para> 342 </xsl:for-each> 343 </refsect1> 344 </xsl:if> 345 346 <xsl:if test="invariant"> 347 <refsect1> 348 <title>Invariants</title> 349 <variablelist> 350 <xsl:for-each select="invariant"> 351 <varlistentry> 352 <term><xsl:value-of select="@name"/></term> 353 <listitem> 354 <para><xsl:apply-templates/></para> 355 </listitem> 356 </varlistentry> 357 </xsl:for-each> 358 </variablelist> 359 </refsect1> 360 </xsl:if> 361 362 <xsl:if test="example-model"> 363 <refsect1> 364 <title>Models</title> 365 <itemizedlist> 366 <xsl:for-each select="example-model"> 367 <listitem> 368 <simplelist type="inline"> 369 <xsl:for-each select="*"> 370 <xsl:variable name="example-value"> 371 <xsl:call-template name="unparse-cpp"> 372 <xsl:with-param name="typeref" select="."/> 373 <xsl:with-param name="definition_list" select="$definition_list"/> 374 </xsl:call-template> 375 </xsl:variable> 376 <member><type><xsl:value-of select="$example-value"/></type></member> 377 </xsl:for-each> 378 </simplelist> 379 </listitem> 380 </xsl:for-each> 381 </itemizedlist> 382 </refsect1> 383 </xsl:if> 384 385 <xsl:variable name="see-also-list-0" select="concept-ref | see-also | refines | refines-when-mutable | models-as-first-arg | models | models-when-mutable"/> 386 <xsl:variable name="see-also-list-1" select="$see-also-list-0[string(@name | @concept) != string(../@name)]"/> 387 <xsl:variable name="see-also-list" select="$see-also-list-1[not(string(@name|@concept) = (preceding::*/@name | preceding::*/@concept | ancestor::*/@name | ancestor::*/@concept))]"/> 388 <xsl:if test="$see-also-list"> 389 <refsect1> 390 <title>See also</title> 391 <itemizedlist> 392 <xsl:for-each select="$see-also-list"> 393 <xsl:sort select="string(@name|@concept)" data-type="text"/> 394 <listitem> 395 <para> 396 <xsl:call-template name="concept.link"> 397 <xsl:with-param name="name" select="@name|@concept"/> 398 </xsl:call-template> 399 </para> 400 </listitem> 401 </xsl:for-each> 402 </itemizedlist> 403 </refsect1> 404 </xsl:if> 405 406 </refentry> 407 </xsl:template> 408 409 <xsl:template name="unparse-constraint"> 410 <xsl:param name="constraint"/> 411 <xsl:param name="definition_list"/> 412 <xsl:param name="type-expr-mode" select="false()"/> 413 <xsl:param name="capitalize" select="true()"/> 414 415 <xsl:choose> 416 417 <xsl:when test="name($constraint)='require-same-type'"> 418 <xsl:if test="$type-expr-mode">identical to </xsl:if> 419 <type> 420 <xsl:call-template name="unparse-cpp"> 421 <xsl:with-param name="typeref" select="$constraint/*[1]"/> 422 <xsl:with-param name="definition_list" select="definition_list"/> 423 </xsl:call-template> 424 </type> 425 </xsl:when> 426 427 <xsl:when test="name($constraint)='convertible-to'"> 428 <xsl:choose> 429 <xsl:when test="$type-expr-mode">convertible to </xsl:when> 430 <xsl:when test="not($type-expr-mode) and $capitalize">Convertible to </xsl:when> 431 <xsl:when test="not($type-expr-mode) and not($capitalize)">convertible to </xsl:when> 432 </xsl:choose> 433 <type> 434 <xsl:call-template name="unparse-cpp"> 435 <xsl:with-param name="typeref" select="$constraint/*[1]"/> 436 <xsl:with-param name="definition_list" select="definition_list"/> 437 </xsl:call-template> 438 </type> 439 </xsl:when> 440 441 <xsl:when test="name($constraint)='derived-from'"> 442 <xsl:choose> 443 <xsl:when test="$type-expr-mode">derived from </xsl:when> 444 <xsl:when test="not($type-expr-mode) and $capitalize">Derived from </xsl:when> 445 <xsl:when test="not($type-expr-mode) and not($capitalize)">derived from </xsl:when> 446 </xsl:choose> 447 <type> 448 <xsl:call-template name="unparse-cpp"> 449 <xsl:with-param name="typeref" select="$constraint/*[1]"/> 450 <xsl:with-param name="definition_list" select="definition_list"/> 451 </xsl:call-template> 452 </type> 453 </xsl:when> 454 455 <xsl:when test="name($constraint)='assignable-to'"> 456 <xsl:choose> 457 <xsl:when test="$type-expr-mode">assignable to </xsl:when> 458 <xsl:when test="not($type-expr-mode) and $capitalize">Assignable to </xsl:when> 459 <xsl:when test="not($type-expr-mode) and not($capitalize)">assignable to </xsl:when> 460 </xsl:choose> 461 <type> 462 <xsl:call-template name="unparse-cpp"> 463 <xsl:with-param name="typeref" select="$constraint/*[1]"/> 464 <xsl:with-param name="definition_list" select="definition_list"/> 465 </xsl:call-template> 466 </type> 467 </xsl:when> 468 469 <xsl:when test="name($constraint)='models-as-first-arg'"> 470 <xsl:choose> 471 <xsl:when test="$type-expr-mode"> a model </xsl:when> 472 <xsl:when test="not($type-expr-mode) and $capitalize"> Models </xsl:when> 473 <xsl:when test="not($type-expr-mode) and not($capitalize)"> models </xsl:when> 474 </xsl:choose> 475 <xsl:if test="$constraint/*"><xsl:comment/> 476 (along with <xsl:for-each select="$constraint/*"><type> 477 <xsl:call-template name="unparse-cpp"> 478 <xsl:with-param name="typeref" select="."/> 479 <xsl:with-param name="definition_list" select="definition_list"/> 480 </xsl:call-template> 481 </type> 482 <xsl:choose> 483 <xsl:when test="position()=last()"/> 484 <xsl:when test="position()=last()-1 and last()=2"> and </xsl:when> 485 <xsl:when test="position()=last()-1 and last()!=2">, and </xsl:when> 486 <xsl:otherwise>, </xsl:otherwise> 487 </xsl:choose><xsl:comment/> 488 </xsl:for-each><xsl:comment/>) <xsl:comment/> 489 </xsl:if><xsl:comment/> 490 <xsl:if test="$type-expr-mode"> of </xsl:if> 491 <xsl:call-template name="concept.link"> 492 <xsl:with-param name="name" select="$constraint/@concept"/> 493 </xsl:call-template> 494 </xsl:when> 495 496 </xsl:choose> 497 </xsl:template> 498 499 <xsl:template name="make-definition-list"> 500 <xsl:param name="typedefs"/> 501 <xsl:param name="definition_list"/> 502 503 <xsl:choose> 504 <xsl:when test="$typedefs"> 505 <xsl:variable name="type_definition"> 506 <xsl:if test="name($typedefs[1]/*[1])!='description'"> 507 <xsl:call-template name="unparse-cpp"> 508 <xsl:with-param name="typeref" select="$typedefs[1]/*[1]"/> 509 <xsl:with-param name="definition_list" select="$definition_list"/> 510 </xsl:call-template> 511 </xsl:if> 512 </xsl:variable> 513 514 <xsl:variable name="new_type_definition"> 515 <xsl:choose> 516 <xsl:when test="name($typedefs[1])='associated-type'"> 517 <xsl:value-of select="$typedefs[1]/@name"/> 518 </xsl:when> 519 <xsl:otherwise> 520 <xsl:value-of select="$type_definition"/> 521 </xsl:otherwise> 522 </xsl:choose> 523 </xsl:variable> 524 525 <xsl:call-template name="make-definition-list"> 526 <xsl:with-param name="typedefs" select="$typedefs[position()!=1]"/> 527 <xsl:with-param name="definition_list" select="concat($definition_list, ' @(@', $typedefs[1]/@name, '=', $new_type_definition, '@)@')"/> 528 </xsl:call-template> 529 530 </xsl:when> 531 532 <xsl:otherwise> <!-- End of expression list, emit the results that have accumulated --> 533 <xsl:value-of select="$definition_list"/> 534 </xsl:otherwise> 535 </xsl:choose> 536 </xsl:template> 537 538 <xsl:template name="print-associated-types"> 539 <xsl:param name="typedefs"/> 540 <xsl:param name="definition_list"/> 541 542 <xsl:if test="$typedefs"> 543 <refsect1> 544 <title>Associated types</title> 545 546 <xsl:choose> 547 <xsl:when test="$boost.concept.layout='sgi'"> 548 <informaltable> 549 <tgroup cols="2"> 550 <tbody> 551 <xsl:apply-templates select="associated-type" mode="sgi"> 552 <xsl:with-param name="definition_list" 553 select="$definition_list"/> 554 </xsl:apply-templates> 555 </tbody> 556 </tgroup> 557 </informaltable> 558 </xsl:when> 559 <xsl:when test="$boost.concept.layout='austern'"> 560 <itemizedlist> 561 <xsl:apply-templates select="associated-type" mode="austern"> 562 <xsl:with-param name="definition_list" 563 select="$definition_list"/> 564 </xsl:apply-templates> 565 </itemizedlist> 566 </xsl:when> 567 <xsl:when test="$boost.concept.layout='caramel'"> 568 <segmentedlist> 569 <segtitle>Name</segtitle> 570 <segtitle>Code</segtitle> 571 <segtitle>Description</segtitle> 572 <xsl:for-each select="$typedefs"> 573 <xsl:variable name="type_definition"> 574 <xsl:call-template name="unparse-cpp"> 575 <xsl:with-param name="typeref" select="*[1]"/> 576 <xsl:with-param name="definition_list" select="$definition_list"/> 577 </xsl:call-template> 578 </xsl:variable> 579 <seglistitem> 580 <seg><xsl:value-of select="@name"/></seg> 581 <seg><xsl:value-of select="$type_definition"/></seg> 582 <seg> 583 <xsl:for-each select="description"> 584 <xsl:call-template name="description"/> 585 </xsl:for-each> 586 </seg> 587 </seglistitem> 588 </xsl:for-each> 589 </segmentedlist> 590 </xsl:when> 591 </xsl:choose> 592 </refsect1> 593 </xsl:if> 594 </xsl:template> 595 596 <xsl:template name="comma-list"> 597 <xsl:param name="list"/> 598 599 <xsl:if test="$list!=''"> 600 <term><varname> 601 <xsl:if test="substring-before($list,' ')=''"><xsl:value-of select="$list"/></xsl:if> 602 <xsl:value-of select="substring-before($list,' ')"/> 603 </varname></term> 604 <xsl:call-template name="comma-list"> 605 <xsl:with-param name="list" select="substring-after($list,' ')"/> 606 </xsl:call-template> 607 </xsl:if> 608 </xsl:template> 609 610 <xsl:template match="associated-type" mode="sgi"> 611 <row> 612 <entry><simpara><xsl:value-of select="@name"/></simpara></entry> 613 614 <entry> 615 <para> 616 <xsl:for-each select="description"> 617 <xsl:apply-templates/> 618 </xsl:for-each> 619 </para> 620 </entry> 621 </row> 622 </xsl:template> 623 624 <xsl:template match="associated-type" mode="austern"> 625 <xsl:param name="definition_list" select="''"/> 626 627 <listitem> 628 <para> 629 <emphasis role="bold"><xsl:value-of select="@name"/></emphasis> 630 631 <xsl:call-template name="preformatted"> 632 <xsl:with-param name="text"> 633 <xsl:call-template name="unparse-cpp"> 634 <xsl:with-param name="typeref" select="*[1]"/> 635 <xsl:with-param name="definition_list" select="$definition_list"/> 636 </xsl:call-template> 637 </xsl:with-param> 638 </xsl:call-template> 639 640 <xsl:for-each select="description"> 641 <xsl:apply-templates/> 642 </xsl:for-each> 643 </para> 644 </listitem> 645 </xsl:template> 646 647 <xsl:template match="valid-expression"> 648 <xsl:param name="definition_list"/> 649 <xsl:param name="notations"/> 650 <xsl:param name="columns"/> 651 652 <row> 653 <entry><simpara><xsl:value-of select="@name"/></simpara></entry> 654 655 <entry> 656 <simpara> 657 <xsl:call-template name="unparse-cpp"> 658 <xsl:with-param name="typeref" select="*[1]"/> 659 <xsl:with-param name="definition_list" select="$definition_list"/> 660 <xsl:with-param name="notations" select="$notations"/> 661 </xsl:call-template> 662 </simpara> 663 </entry> 664 665 <xsl:if test="contains($columns, 'T')"> 666 <entry> 667 <simpara> 668 <xsl:for-each select="return-type/*"> 669 <xsl:if test="position()!=1 and last()!=2">, </xsl:if> 670 <xsl:if test="position()=last() and last()!=1"> and </xsl:if> 671 <xsl:call-template name="unparse-constraint"> 672 <xsl:with-param name="constraint" select="."/> 673 <xsl:with-param name="definition_list" 674 select="$definition_list"/> 675 <xsl:with-param name="capitalize" select="position()=1"/> 676 </xsl:call-template> 677 </xsl:for-each> 678 </simpara> 679 </entry> 680 </xsl:if> 681 682 <xsl:if test="contains($columns, 'P')"> 683 <entry> 684 <xsl:for-each select="precondition"> 685 <simpara><xsl:apply-templates/></simpara> 686 </xsl:for-each> 687 </entry> 688 </xsl:if> 689 690 <xsl:if test="contains($columns, 'S')"> 691 <entry> 692 <xsl:for-each select="semantics"> 693 <simpara><xsl:apply-templates/></simpara> 694 </xsl:for-each> 695 </entry> 696 </xsl:if> 697 698 <xsl:if test="contains($columns, 'O')"> 699 <entry> 700 <xsl:for-each select="postcondition"> 701 <simpara><xsl:apply-templates/></simpara> 702 </xsl:for-each> 703 </entry> 704 </xsl:if> 705 </row> 706 </xsl:template> 707 708 <xsl:template name="concept.notation"> 709 <xsl:param name="definition_list"/> 710 711 <refsect1> 712 <title>Notation</title> 713 <variablelist> 714 <xsl:for-each select="param"> 715 <varlistentry> 716 <term><xsl:value-of select="@name"/></term> 717 <listitem> 718 <simpara> 719 <xsl:text>A type playing the role of </xsl:text> 720 <xsl:value-of select="@role"/> 721 <xsl:text> in the </xsl:text> 722 <xsl:call-template name="concept.link"> 723 <xsl:with-param name="name" select="../@name"/> 724 </xsl:call-template> 725 <xsl:text> concept.</xsl:text> 726 </simpara> 727 </listitem> 728 </varlistentry> 729 </xsl:for-each> 730 <xsl:for-each select="notation"> 731 <xsl:variable name="notation_name"> 732 <xsl:call-template name="comma-list"> 733 <xsl:with-param name="list" 734 select="normalize-space(@variables)"/> 735 </xsl:call-template> 736 </xsl:variable> 737 738 <varlistentry> 739 <xsl:copy-of select="$notation_name"/> 740 <listitem> 741 <simpara> 742 <xsl:variable name="output-plural" select="substring-before(normalize-space(@variables),' ')!=''"/> 743 <xsl:if test="name(*[1])='sample-value'">Object<xsl:if test="$output-plural">s</xsl:if> of type </xsl:if> 744 <xsl:variable name="typeref-to-print" select="*[name()!='sample-value'] | sample-value/*[name()!='sample-value']"/> 745 <xsl:call-template name="unparse-cpp"> 746 <xsl:with-param name="typeref" select="$typeref-to-print"/> 747 <xsl:with-param name="definition_list" select="$definition_list"/> 748 <xsl:with-param name="ignore-cv" select="true()"/> 749 <xsl:with-param name="ignore-references" select="true()"/> 750 </xsl:call-template> 751 </simpara> 752 </listitem> 753 </varlistentry> 754 </xsl:for-each> 755 </variablelist> 756 </refsect1> 757 </xsl:template> 758 759 <xsl:template name="concept.link"> 760 <xsl:param name="name" select="text()"/> 761 <xsl:param name="warn" select="true()"/> 762 <xsl:param name="text" select="$name"/> 763 <xsl:variable name="node" select="key('concepts', $name)"/> 764 765 <xsl:choose> 766 <xsl:when test="count($node)=0"> 767 <xsl:if test="$warn"> 768 <xsl:message> 769 <xsl:text>warning: cannot find concept '</xsl:text> 770 <xsl:value-of select="$name"/> 771 <xsl:text>'</xsl:text> 772 </xsl:message> 773 </xsl:if> 774 <xsl:value-of select="$text"/> 775 </xsl:when> 776 <xsl:otherwise> 777 <xsl:call-template name="internal-link"> 778 <xsl:with-param name="to"> 779 <xsl:call-template name="generate.id"> 780 <xsl:with-param name="node" select="$node"/> 781 </xsl:call-template> 782 </xsl:with-param> 783 <xsl:with-param name="text" select="$text"/> 784 </xsl:call-template> 785 </xsl:otherwise> 786 </xsl:choose> 787 </xsl:template> 788 789 <xsl:template name="remove-whitespace"> 790 <xsl:param name="text" select="text()"/> 791 792 <xsl:variable name="normalized" select="normalize-space($text)"/> 793 <xsl:choose> 794 <xsl:when test="contains($normalized, ' ')"> 795 <xsl:value-of select="substring-before($normalized, ' ')"/> 796 <xsl:call-template name="remove-whitespace"> 797 <xsl:with-param name="text" 798 select="substring-after($normalized, ' ')"/> 799 </xsl:call-template> 800 </xsl:when> 801 <xsl:otherwise> 802 <xsl:value-of select="$normalized"/> 803 </xsl:otherwise> 804 </xsl:choose> 805 </xsl:template> 806 807 <xsl:template match="concept" mode="generate.id"> 808 <xsl:call-template name="remove-whitespace"> 809 <xsl:with-param name="text" select="@name"/> 810 </xsl:call-template> 811 </xsl:template> 812</xsl:stylesheet> 813