1<?xml version='1.0'?> 2<!DOCTYPE xsl:stylesheet [ 3 <!ENTITY comment.block.parents "parent::answer|parent::appendix|parent::article|parent::bibliodiv| 4 parent::bibliography|parent::blockquote|parent::caution|parent::chapter| 5 parent::glossary|parent::glossdiv|parent::important|parent::index| 6 parent::indexdiv|parent::listitem|parent::note|parent::orderedlist| 7 parent::partintro|parent::preface|parent::procedure|parent::qandadiv| 8 parent::qandaset|parent::question|parent::refentry|parent::refnamediv| 9 parent::refsect1|parent::refsect2|parent::refsect3|parent::refsection| 10 parent::refsynopsisdiv|parent::sect1|parent::sect2|parent::sect3|parent::sect4| 11 parent::sect5|parent::section|parent::setindex|parent::sidebar| 12 parent::simplesect|parent::taskprerequisites|parent::taskrelated| 13 parent::tasksummary|parent::warning"> 14]> 15<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 16 xmlns:xlink='http://www.w3.org/1999/xlink' 17 xmlns:suwl="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.UnwrapLinks" 18 exclude-result-prefixes="xlink suwl" 19 version='1.0'> 20 21<!-- ******************************************************************** 22 $Id: inline.xsl,v 1.49 2006/05/08 04:23:10 bobstayton Exp $ 23 ******************************************************************** 24 25 This file is part of the XSL DocBook Stylesheet distribution. 26 See ../README or http://nwalsh.com/docbook/xsl/ for copyright 27 and other information. 28 29 ******************************************************************** --> 30 31<xsl:template name="simple.xlink"> 32 <xsl:param name="node" select="."/> 33 <xsl:param name="content"> 34 <xsl:apply-templates/> 35 </xsl:param> 36 37 <xsl:variable name="link"> 38 <xsl:choose> 39 <xsl:when test="$node/@xlink:href 40 and (not($node/@xlink:type) or $node/@xlink:type='simple')"> 41 <a> 42 <xsl:if test="@xlink.title"> 43 <xsl:attribute name="title"> 44 <xsl:value-of select="@xlink:title"/> 45 </xsl:attribute> 46 </xsl:if> 47 48 <xsl:attribute name="href"> 49 <xsl:choose> 50 <!-- if the href starts with # and does not contain an "(" --> 51 <!-- or if the href starts with #xpointer(id(, it's just an ID --> 52 <xsl:when test="starts-with(@xlink:href,'#') 53 and (not(contains(@xlink:href,'(')) 54 or starts-with(@xlink:href,'#xpointer(id('))"> 55 <xsl:variable name="idref"> 56 <xsl:call-template name="xpointer.idref"> 57 <xsl:with-param name="xpointer" select="@xlink:href"/> 58 </xsl:call-template> 59 </xsl:variable> 60 61 <xsl:variable name="targets" select="key('id',$idref)"/> 62 <xsl:variable name="target" select="$targets[1]"/> 63 64 <xsl:call-template name="check.id.unique"> 65 <xsl:with-param name="linkend" select="@linkend"/> 66 </xsl:call-template> 67 68 <xsl:choose> 69 <xsl:when test="count($target) = 0"> 70 <xsl:message> 71 <xsl:text>XLink to nonexistent id: </xsl:text> 72 <xsl:value-of select="$idref"/> 73 </xsl:message> 74 <xsl:text>???</xsl:text> 75 </xsl:when> 76 <xsl:otherwise> 77 <xsl:call-template name="href.target"> 78 <xsl:with-param name="object" select="$target"/> 79 </xsl:call-template> 80 </xsl:otherwise> 81 </xsl:choose> 82 </xsl:when> 83 84 <!-- otherwise it's a URI --> 85 <xsl:otherwise> 86 <xsl:value-of select="@xlink:href"/> 87 </xsl:otherwise> 88 </xsl:choose> 89 </xsl:attribute> 90 <xsl:copy-of select="$content"/> 91 </a> 92 </xsl:when> 93 <xsl:otherwise> 94 <xsl:copy-of select="$content"/> 95 </xsl:otherwise> 96 </xsl:choose> 97 </xsl:variable> 98 99 <xsl:choose> 100 <xsl:when test="function-available('suwl:unwrapLinks')"> 101 <xsl:copy-of select="suwl:unwrapLinks($link)"/> 102 </xsl:when> 103 <xsl:otherwise> 104 <xsl:copy-of select="$link"/> 105 </xsl:otherwise> 106 </xsl:choose> 107</xsl:template> 108 109<xsl:template name="inline.charseq"> 110 <xsl:param name="content"> 111 <xsl:call-template name="anchor"/> 112 <xsl:call-template name="simple.xlink"> 113 <xsl:with-param name="content"> 114 <xsl:apply-templates/> 115 </xsl:with-param> 116 </xsl:call-template> 117 </xsl:param> 118 <!-- * if you want output from the inline.charseq template wrapped in --> 119 <!-- * something other than a Span, call the template with some value --> 120 <!-- * for the 'wrapper-name' param --> 121 <xsl:param name="wrapper-name">span</xsl:param> 122 <xsl:element name="{$wrapper-name}"> 123 <xsl:attribute name="class"> 124 <xsl:value-of select="local-name(.)"/> 125 </xsl:attribute> 126 <xsl:call-template name="dir"/> 127 <xsl:call-template name="generate.html.title"/> 128 <xsl:copy-of select="$content"/> 129 <xsl:call-template name="apply-annotations"/> 130 </xsl:element> 131</xsl:template> 132 133<xsl:template name="inline.monoseq"> 134 <xsl:param name="content"> 135 <xsl:call-template name="anchor"/> 136 <xsl:call-template name="simple.xlink"> 137 <xsl:with-param name="content"> 138 <xsl:apply-templates/> 139 </xsl:with-param> 140 </xsl:call-template> 141 </xsl:param> 142 <code class="{local-name(.)}"> 143 <xsl:call-template name="dir"/> 144 <xsl:call-template name="generate.html.title"/> 145 <xsl:copy-of select="$content"/> 146 <xsl:call-template name="apply-annotations"/> 147 </code> 148</xsl:template> 149 150<xsl:template name="inline.boldseq"> 151 <xsl:param name="content"> 152 <xsl:call-template name="anchor"/> 153 <xsl:call-template name="simple.xlink"> 154 <xsl:with-param name="content"> 155 <xsl:apply-templates/> 156 </xsl:with-param> 157 </xsl:call-template> 158 </xsl:param> 159 160 <span> 161 <xsl:call-template name="generate.html.title"/> 162 <xsl:call-template name="dir"/> 163 164 <!-- don't put <strong> inside figure, example, or table titles --> 165 <xsl:choose> 166 <xsl:when test="local-name(..) = 'title' 167 and (local-name(../..) = 'figure' 168 or local-name(../..) = 'example' 169 or local-name(../..) = 'table')"> 170 <xsl:copy-of select="$content"/> 171 </xsl:when> 172 <xsl:otherwise> 173 <strong class="{local-name(.)}"> 174 <xsl:copy-of select="$content"/> 175 </strong> 176 </xsl:otherwise> 177 </xsl:choose> 178 <xsl:call-template name="apply-annotations"/> 179 </span> 180</xsl:template> 181 182<xsl:template name="inline.italicseq"> 183 <xsl:param name="content"> 184 <xsl:call-template name="anchor"/> 185 <xsl:call-template name="simple.xlink"> 186 <xsl:with-param name="content"> 187 <xsl:apply-templates/> 188 </xsl:with-param> 189 </xsl:call-template> 190 </xsl:param> 191 <em class="{local-name(.)}"> 192 <xsl:call-template name="generate.html.title"/> 193 <xsl:call-template name="dir"/> 194 <xsl:copy-of select="$content"/> 195 <xsl:call-template name="apply-annotations"/> 196 </em> 197</xsl:template> 198 199<xsl:template name="inline.boldmonoseq"> 200 <xsl:param name="content"> 201 <xsl:call-template name="anchor"/> 202 <xsl:call-template name="simple.xlink"> 203 <xsl:with-param name="content"> 204 <xsl:apply-templates/> 205 </xsl:with-param> 206 </xsl:call-template> 207 </xsl:param> 208 <!-- don't put <strong> inside figure, example, or table titles --> 209 <!-- or other titles that may already be represented with <strong>'s. --> 210 <xsl:choose> 211 <xsl:when test="local-name(..) = 'title' 212 and (local-name(../..) = 'figure' 213 or local-name(../..) = 'example' 214 or local-name(../..) = 'table' 215 or local-name(../..) = 'formalpara')"> 216 <code class="{local-name(.)}"> 217 <xsl:call-template name="generate.html.title"/> 218 <xsl:call-template name="dir"/> 219 <xsl:copy-of select="$content"/> 220 <xsl:call-template name="apply-annotations"/> 221 </code> 222 </xsl:when> 223 <xsl:otherwise> 224 <strong class="{local-name(.)}"> 225 <code> 226 <xsl:call-template name="generate.html.title"/> 227 <xsl:call-template name="dir"/> 228 <xsl:copy-of select="$content"/> 229 </code> 230 <xsl:call-template name="apply-annotations"/> 231 </strong> 232 </xsl:otherwise> 233 </xsl:choose> 234</xsl:template> 235 236<xsl:template name="inline.italicmonoseq"> 237 <xsl:param name="content"> 238 <xsl:call-template name="anchor"/> 239 <xsl:call-template name="simple.xlink"> 240 <xsl:with-param name="content"> 241 <xsl:apply-templates/> 242 </xsl:with-param> 243 </xsl:call-template> 244 </xsl:param> 245 <em class="{local-name(.)}"> 246 <code> 247 <xsl:call-template name="generate.html.title"/> 248 <xsl:call-template name="dir"/> 249 <xsl:copy-of select="$content"/> 250 <xsl:call-template name="apply-annotations"/> 251 </code> 252 </em> 253</xsl:template> 254 255<xsl:template name="inline.superscriptseq"> 256 <xsl:param name="content"> 257 <xsl:call-template name="anchor"/> 258 <xsl:call-template name="simple.xlink"> 259 <xsl:with-param name="content"> 260 <xsl:apply-templates/> 261 </xsl:with-param> 262 </xsl:call-template> 263 </xsl:param> 264 <sup> 265 <xsl:call-template name="generate.html.title"/> 266 <xsl:call-template name="dir"/> 267 <xsl:copy-of select="$content"/> 268 <xsl:call-template name="apply-annotations"/> 269 </sup> 270</xsl:template> 271 272<xsl:template name="inline.subscriptseq"> 273 <xsl:param name="content"> 274 <xsl:call-template name="anchor"/> 275 <xsl:call-template name="simple.xlink"> 276 <xsl:with-param name="content"> 277 <xsl:apply-templates/> 278 </xsl:with-param> 279 </xsl:call-template> 280 </xsl:param> 281 <sub> 282 <xsl:call-template name="generate.html.title"/> 283 <xsl:call-template name="dir"/> 284 <xsl:copy-of select="$content"/> 285 <xsl:call-template name="apply-annotations"/> 286 </sub> 287</xsl:template> 288 289<!-- ==================================================================== --> 290<!-- some special cases --> 291 292<xsl:template match="author"> 293 <span class="{name(.)}"> 294 <xsl:call-template name="anchor"/> 295 <xsl:call-template name="person.name"/> 296 <xsl:call-template name="apply-annotations"/> 297 </span> 298</xsl:template> 299 300<xsl:template match="editor"> 301 <span class="{name(.)}"> 302 <xsl:call-template name="anchor"/> 303 <xsl:call-template name="person.name"/> 304 <xsl:call-template name="apply-annotations"/> 305 </span> 306</xsl:template> 307 308<xsl:template match="othercredit"> 309 <span class="{name(.)}"> 310 <xsl:call-template name="anchor"/> 311 <xsl:call-template name="person.name"/> 312 <xsl:call-template name="apply-annotations"/> 313 </span> 314</xsl:template> 315 316<xsl:template match="authorinitials"> 317 <xsl:call-template name="inline.charseq"/> 318</xsl:template> 319 320<!-- ==================================================================== --> 321 322<xsl:template match="accel"> 323 <xsl:call-template name="inline.charseq"/> 324</xsl:template> 325 326<xsl:template match="action"> 327 <xsl:call-template name="inline.charseq"/> 328</xsl:template> 329 330<xsl:template match="application"> 331 <xsl:call-template name="inline.charseq"/> 332</xsl:template> 333 334<xsl:template match="classname"> 335 <xsl:call-template name="inline.monoseq"/> 336</xsl:template> 337 338<xsl:template match="exceptionname"> 339 <xsl:call-template name="inline.monoseq"/> 340</xsl:template> 341 342<xsl:template match="interfacename"> 343 <xsl:call-template name="inline.monoseq"/> 344</xsl:template> 345 346<xsl:template match="methodname"> 347 <xsl:call-template name="inline.monoseq"/> 348</xsl:template> 349 350<xsl:template match="command"> 351 <xsl:call-template name="inline.boldseq"/> 352</xsl:template> 353 354<xsl:template match="computeroutput"> 355 <xsl:call-template name="inline.monoseq"/> 356</xsl:template> 357 358<xsl:template match="constant"> 359 <xsl:call-template name="inline.monoseq"/> 360</xsl:template> 361 362<xsl:template match="database"> 363 <xsl:call-template name="inline.charseq"/> 364</xsl:template> 365 366<xsl:template match="date"> 367 <!-- should this support locale-specific formatting? how? --> 368 <xsl:call-template name="inline.charseq"/> 369</xsl:template> 370 371<xsl:template match="errorcode"> 372 <xsl:call-template name="inline.charseq"/> 373</xsl:template> 374 375<xsl:template match="errorname"> 376 <xsl:call-template name="inline.charseq"/> 377</xsl:template> 378 379<xsl:template match="errortype"> 380 <xsl:call-template name="inline.charseq"/> 381</xsl:template> 382 383<xsl:template match="errortext"> 384 <xsl:call-template name="inline.charseq"/> 385</xsl:template> 386 387<xsl:template match="envar"> 388 <xsl:call-template name="inline.monoseq"/> 389</xsl:template> 390 391<xsl:template match="filename"> 392 <xsl:call-template name="inline.monoseq"/> 393</xsl:template> 394 395<xsl:template match="function"> 396 <xsl:choose> 397 <xsl:when test="$function.parens != '0' 398 and (parameter or function or replaceable)"> 399 <xsl:variable name="nodes" select="text()|*"/> 400 <xsl:call-template name="inline.monoseq"> 401 <xsl:with-param name="content"> 402 <xsl:call-template name="simple.xlink"> 403 <xsl:with-param name="content"> 404 <xsl:apply-templates select="$nodes[1]"/> 405 </xsl:with-param> 406 </xsl:call-template> 407 </xsl:with-param> 408 </xsl:call-template> 409 <xsl:text>(</xsl:text> 410 <xsl:apply-templates select="$nodes[position()>1]"/> 411 <xsl:text>)</xsl:text> 412 </xsl:when> 413 <xsl:otherwise> 414 <xsl:call-template name="inline.monoseq"/> 415 </xsl:otherwise> 416 </xsl:choose> 417</xsl:template> 418 419<xsl:template match="function/parameter" priority="2"> 420 <xsl:call-template name="inline.italicmonoseq"/> 421 <xsl:if test="following-sibling::*"> 422 <xsl:text>, </xsl:text> 423 </xsl:if> 424</xsl:template> 425 426<xsl:template match="function/replaceable" priority="2"> 427 <xsl:call-template name="inline.italicmonoseq"/> 428 <xsl:if test="following-sibling::*"> 429 <xsl:text>, </xsl:text> 430 </xsl:if> 431</xsl:template> 432 433<xsl:template match="guibutton"> 434 <xsl:call-template name="inline.charseq"/> 435</xsl:template> 436 437<xsl:template match="guiicon"> 438 <xsl:call-template name="inline.charseq"/> 439</xsl:template> 440 441<xsl:template match="guilabel"> 442 <xsl:call-template name="inline.charseq"/> 443</xsl:template> 444 445<xsl:template match="guimenu"> 446 <xsl:call-template name="inline.charseq"/> 447</xsl:template> 448 449<xsl:template match="guimenuitem"> 450 <xsl:call-template name="inline.charseq"/> 451</xsl:template> 452 453<xsl:template match="guisubmenu"> 454 <xsl:call-template name="inline.charseq"/> 455</xsl:template> 456 457<xsl:template match="hardware"> 458 <xsl:call-template name="inline.charseq"/> 459</xsl:template> 460 461<xsl:template match="interface"> 462 <xsl:call-template name="inline.charseq"/> 463</xsl:template> 464 465<xsl:template match="interfacedefinition"> 466 <xsl:call-template name="inline.charseq"/> 467</xsl:template> 468 469<xsl:template match="keycap"> 470 <xsl:call-template name="inline.boldseq"/> 471</xsl:template> 472 473<xsl:template match="keycode"> 474 <xsl:call-template name="inline.charseq"/> 475</xsl:template> 476 477<xsl:template match="keysym"> 478 <xsl:call-template name="inline.charseq"/> 479</xsl:template> 480 481<xsl:template match="literal"> 482 <xsl:call-template name="inline.monoseq"/> 483</xsl:template> 484 485<xsl:template match="code"> 486 <xsl:call-template name="inline.monoseq"/> 487</xsl:template> 488 489<xsl:template match="medialabel"> 490 <xsl:call-template name="inline.italicseq"/> 491</xsl:template> 492 493<xsl:template match="shortcut"> 494 <xsl:call-template name="inline.boldseq"/> 495</xsl:template> 496 497<xsl:template match="mousebutton"> 498 <xsl:call-template name="inline.charseq"/> 499</xsl:template> 500 501<xsl:template match="option"> 502 <xsl:call-template name="inline.monoseq"/> 503</xsl:template> 504 505<xsl:template match="package"> 506 <xsl:call-template name="inline.charseq"/> 507</xsl:template> 508 509<xsl:template match="parameter"> 510 <xsl:call-template name="inline.italicmonoseq"/> 511</xsl:template> 512 513<xsl:template match="property"> 514 <xsl:call-template name="inline.charseq"/> 515</xsl:template> 516 517<xsl:template match="prompt"> 518 <xsl:call-template name="inline.monoseq"/> 519</xsl:template> 520 521<xsl:template match="replaceable" priority="1"> 522 <xsl:call-template name="inline.italicmonoseq"/> 523</xsl:template> 524 525<xsl:template match="returnvalue"> 526 <xsl:call-template name="inline.charseq"/> 527</xsl:template> 528 529<xsl:template match="structfield"> 530 <xsl:call-template name="inline.italicmonoseq"/> 531</xsl:template> 532 533<xsl:template match="structname"> 534 <xsl:call-template name="inline.charseq"/> 535</xsl:template> 536 537<xsl:template match="symbol"> 538 <xsl:call-template name="inline.charseq"/> 539</xsl:template> 540 541<xsl:template match="systemitem"> 542 <xsl:call-template name="inline.monoseq"/> 543</xsl:template> 544 545<xsl:template match="token"> 546 <xsl:call-template name="inline.charseq"/> 547</xsl:template> 548 549<xsl:template match="type"> 550 <xsl:call-template name="inline.charseq"/> 551</xsl:template> 552 553<xsl:template match="userinput"> 554 <xsl:call-template name="inline.boldmonoseq"/> 555</xsl:template> 556 557<xsl:template match="abbrev"> 558 <xsl:call-template name="inline.charseq"> 559 <xsl:with-param name="wrapper-name">abbr</xsl:with-param> 560 </xsl:call-template> 561</xsl:template> 562 563<xsl:template match="acronym"> 564 <xsl:call-template name="inline.charseq"> 565 <xsl:with-param name="wrapper-name">acronym</xsl:with-param> 566 </xsl:call-template> 567</xsl:template> 568 569<xsl:template match="citerefentry"> 570 <xsl:choose> 571 <xsl:when test="$citerefentry.link != '0'"> 572 <a> 573 <xsl:attribute name="href"> 574 <xsl:call-template name="generate.citerefentry.link"/> 575 </xsl:attribute> 576 <xsl:call-template name="inline.charseq"/> 577 </a> 578 </xsl:when> 579 <xsl:otherwise> 580 <xsl:call-template name="inline.charseq"/> 581 </xsl:otherwise> 582 </xsl:choose> 583</xsl:template> 584 585<xsl:template name="generate.citerefentry.link"> 586 <!-- nop --> 587</xsl:template> 588 589<xsl:template name="x.generate.citerefentry.link"> 590 <xsl:text>http://example.com/cgi-bin/man.cgi?</xsl:text> 591 <xsl:value-of select="refentrytitle"/> 592 <xsl:text>(</xsl:text> 593 <xsl:value-of select="manvolnum"/> 594 <xsl:text>)</xsl:text> 595</xsl:template> 596 597<xsl:template match="citetitle"> 598 <xsl:choose> 599 <xsl:when test="@pubwork = 'article'"> 600 <xsl:call-template name="gentext.startquote"/> 601 <xsl:call-template name="inline.charseq"/> 602 <xsl:call-template name="gentext.endquote"/> 603 </xsl:when> 604 <xsl:otherwise> 605 <xsl:call-template name="inline.italicseq"/> 606 </xsl:otherwise> 607 </xsl:choose> 608</xsl:template> 609 610<xsl:template match="emphasis"> 611 <span> 612 <xsl:choose> 613 <xsl:when test="@role and $emphasis.propagates.style != 0"> 614 <xsl:attribute name="class"> 615 <xsl:value-of select="@role"/> 616 </xsl:attribute> 617 </xsl:when> 618 <xsl:otherwise> 619 <xsl:attribute name="class"> 620 <xsl:text>emphasis</xsl:text> 621 </xsl:attribute> 622 </xsl:otherwise> 623 </xsl:choose> 624 <xsl:call-template name="anchor"/> 625 626 <xsl:call-template name="simple.xlink"> 627 <xsl:with-param name="content"> 628 <xsl:choose> 629 <xsl:when test="@role = 'bold' or @role='strong'"> 630 <!-- backwards compatibility: make bold into b elements, but --> 631 <!-- don't put bold inside figure, example, or table titles --> 632 <xsl:choose> 633 <xsl:when test="local-name(..) = 'title' 634 and (local-name(../..) = 'figure' 635 or local-name(../..) = 'example' 636 or local-name(../..) = 'table')"> 637 <xsl:apply-templates/> 638 </xsl:when> 639 <xsl:otherwise> 640 <strong><xsl:apply-templates/></strong> 641 </xsl:otherwise> 642 </xsl:choose> 643 </xsl:when> 644 <xsl:when test="@role and $emphasis.propagates.style != 0"> 645 <xsl:apply-templates/> 646 </xsl:when> 647 <xsl:otherwise> 648 <em><xsl:apply-templates/></em> 649 </xsl:otherwise> 650 </xsl:choose> 651 </xsl:with-param> 652 </xsl:call-template> 653 </span> 654</xsl:template> 655 656<xsl:template match="foreignphrase"> 657 <span class="foreignphrase"> 658 <xsl:if test="@lang or @xml:lang"> 659 <xsl:call-template name="language.attribute"/> 660 </xsl:if> 661 <xsl:call-template name="inline.italicseq"/> 662 </span> 663</xsl:template> 664 665<xsl:template match="markup"> 666 <xsl:call-template name="inline.charseq"/> 667</xsl:template> 668 669<xsl:template match="phrase"> 670 <span> 671 <xsl:call-template name="generate.html.title"/> 672 <xsl:if test="@lang or @xml:lang"> 673 <xsl:call-template name="language.attribute"/> 674 </xsl:if> 675 <xsl:if test="@role and $phrase.propagates.style != 0"> 676 <xsl:attribute name="class"> 677 <xsl:value-of select="@role"/> 678 </xsl:attribute> 679 </xsl:if> 680 <xsl:call-template name="dir"/> 681 <xsl:call-template name="anchor"/> 682 <xsl:call-template name="simple.xlink"> 683 <xsl:with-param name="content"> 684 <xsl:apply-templates/> 685 </xsl:with-param> 686 </xsl:call-template> 687 <xsl:call-template name="apply-annotations"/> 688 </span> 689</xsl:template> 690 691<xsl:template match="quote"> 692 <xsl:variable name="depth"> 693 <xsl:call-template name="dot.count"> 694 <xsl:with-param name="string"> 695 <xsl:number level="multiple"/> 696 </xsl:with-param> 697 </xsl:call-template> 698 </xsl:variable> 699 <xsl:choose> 700 <xsl:when test="$depth mod 2 = 0"> 701 <xsl:call-template name="gentext.startquote"/> 702 <xsl:call-template name="inline.charseq"/> 703 <xsl:call-template name="gentext.endquote"/> 704 </xsl:when> 705 <xsl:otherwise> 706 <xsl:call-template name="gentext.nestedstartquote"/> 707 <xsl:call-template name="inline.charseq"/> 708 <xsl:call-template name="gentext.nestedendquote"/> 709 </xsl:otherwise> 710 </xsl:choose> 711</xsl:template> 712 713<xsl:template match="varname"> 714 <xsl:call-template name="inline.monoseq"/> 715</xsl:template> 716 717<xsl:template match="wordasword"> 718 <xsl:call-template name="inline.italicseq"/> 719</xsl:template> 720 721<xsl:template match="lineannotation"> 722 <em class="{local-name(.)}"> 723 <xsl:call-template name="inline.charseq"/> 724 </em> 725</xsl:template> 726 727<xsl:template match="superscript"> 728 <xsl:call-template name="inline.superscriptseq"/> 729</xsl:template> 730 731<xsl:template match="subscript"> 732 <xsl:call-template name="inline.subscriptseq"/> 733</xsl:template> 734 735<xsl:template match="trademark"> 736 <xsl:call-template name="inline.charseq"/> 737 <xsl:choose> 738 <xsl:when test="@class = 'copyright' 739 or @class = 'registered'"> 740 <xsl:call-template name="dingbat"> 741 <xsl:with-param name="dingbat" select="@class"/> 742 </xsl:call-template> 743 </xsl:when> 744 <xsl:when test="@class = 'service'"> 745 <sup>SM</sup> 746 </xsl:when> 747 <xsl:otherwise> 748 <xsl:call-template name="dingbat"> 749 <xsl:with-param name="dingbat" select="'trademark'"/> 750 </xsl:call-template> 751 </xsl:otherwise> 752 </xsl:choose> 753</xsl:template> 754 755<xsl:template match="firstterm"> 756 <xsl:call-template name="glossterm"> 757 <xsl:with-param name="firstterm" select="1"/> 758 </xsl:call-template> 759</xsl:template> 760 761<xsl:template match="glossterm" name="glossterm"> 762 <xsl:param name="firstterm" select="0"/> 763 764 <!-- To avoid extra <a name=""> anchor from inline.italicseq --> 765 <xsl:variable name="content"> 766 <xsl:apply-templates/> 767 </xsl:variable> 768 769 <xsl:choose> 770 <xsl:when test="($firstterm.only.link = 0 or $firstterm = 1) and @linkend"> 771 <xsl:variable name="targets" select="key('id',@linkend)"/> 772 <xsl:variable name="target" select="$targets[1]"/> 773 774 <xsl:call-template name="check.id.unique"> 775 <xsl:with-param name="linkend" select="@linkend"/> 776 </xsl:call-template> 777 778 <xsl:choose> 779 <xsl:when test="$target"> 780 <a> 781 <xsl:if test="@id"> 782 <xsl:attribute name="name"> 783 <xsl:value-of select="@id"/> 784 </xsl:attribute> 785 </xsl:if> 786 787 <xsl:attribute name="href"> 788 <xsl:call-template name="href.target"> 789 <xsl:with-param name="object" select="$target"/> 790 </xsl:call-template> 791 </xsl:attribute> 792 793 <xsl:call-template name="inline.italicseq"> 794 <xsl:with-param name="content" select="$content"/> 795 </xsl:call-template> 796 </a> 797 </xsl:when> 798 <xsl:otherwise> 799 <xsl:call-template name="inline.italicseq"> 800 <xsl:with-param name="content" select="$content"/> 801 </xsl:call-template> 802 </xsl:otherwise> 803 </xsl:choose> 804 </xsl:when> 805 806 <xsl:when test="not(@linkend) 807 and ($firstterm.only.link = 0 or $firstterm = 1) 808 and ($glossterm.auto.link != 0) 809 and $glossary.collection != ''"> 810 <xsl:variable name="term"> 811 <xsl:choose> 812 <xsl:when test="@baseform"><xsl:value-of select="@baseform"/></xsl:when> 813 <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise> 814 </xsl:choose> 815 </xsl:variable> 816 817 <xsl:variable name="cterm" 818 select="(document($glossary.collection,.)//glossentry[glossterm=$term])[1]"/> 819 820 <!-- HACK HACK HACK! But it works... --> 821 <!-- You'd need to do more work if you wanted to chunk on glossdiv, though --> 822 823 <xsl:variable name="glossary" select="//glossary[@role='auto']"/> 824 825 <xsl:if test="count($glossary) != 1"> 826 <xsl:message> 827 <xsl:text>Warning: glossary.collection specified, but there are </xsl:text> 828 <xsl:value-of select="count($glossary)"/> 829 <xsl:text> automatic glossaries</xsl:text> 830 </xsl:message> 831 </xsl:if> 832 833 <xsl:variable name="glosschunk"> 834 <xsl:call-template name="href.target"> 835 <xsl:with-param name="object" select="$glossary"/> 836 </xsl:call-template> 837 </xsl:variable> 838 839 <xsl:variable name="chunkbase"> 840 <xsl:choose> 841 <xsl:when test="contains($glosschunk, '#')"> 842 <xsl:value-of select="substring-before($glosschunk, '#')"/> 843 </xsl:when> 844 <xsl:otherwise> 845 <xsl:value-of select="$glosschunk"/> 846 </xsl:otherwise> 847 </xsl:choose> 848 </xsl:variable> 849 850 <xsl:choose> 851 <xsl:when test="not($cterm)"> 852 <xsl:message> 853 <xsl:text>There's no entry for </xsl:text> 854 <xsl:value-of select="$term"/> 855 <xsl:text> in </xsl:text> 856 <xsl:value-of select="$glossary.collection"/> 857 </xsl:message> 858 <xsl:call-template name="inline.italicseq"/> 859 </xsl:when> 860 <xsl:otherwise> 861 <xsl:variable name="id"> 862 <xsl:choose> 863 <xsl:when test="$cterm/@id"> 864 <xsl:value-of select="$cterm/@id"/> 865 </xsl:when> 866 <xsl:otherwise> 867 <xsl:value-of select="generate-id($cterm)"/> 868 </xsl:otherwise> 869 </xsl:choose> 870 </xsl:variable> 871 <a href="{$chunkbase}#{$id}"> 872 <xsl:call-template name="inline.italicseq"> 873 <xsl:with-param name="content" select="$content"/> 874 </xsl:call-template> 875 </a> 876 </xsl:otherwise> 877 </xsl:choose> 878 </xsl:when> 879 880 <xsl:when test="not(@linkend) 881 and ($firstterm.only.link = 0 or $firstterm = 1) 882 and $glossterm.auto.link != 0"> 883 <xsl:variable name="term"> 884 <xsl:choose> 885 <xsl:when test="@baseform"> 886 <xsl:value-of select="normalize-space(@baseform)"/> 887 </xsl:when> 888 <xsl:otherwise> 889 <xsl:value-of select="normalize-space(.)"/> 890 </xsl:otherwise> 891 </xsl:choose> 892 </xsl:variable> 893 <xsl:variable name="targets" 894 select="//glossentry[normalize-space(glossterm)=$term 895 or normalize-space(glossterm/@baseform)=$term]"/> 896 <xsl:variable name="target" select="$targets[1]"/> 897 898 <xsl:choose> 899 <xsl:when test="count($targets)=0"> 900 <xsl:message> 901 <xsl:text>Error: no glossentry for glossterm: </xsl:text> 902 <xsl:value-of select="."/> 903 <xsl:text>.</xsl:text> 904 </xsl:message> 905 <xsl:call-template name="inline.italicseq"/> 906 </xsl:when> 907 <xsl:otherwise> 908 <a> 909 <xsl:if test="@id"> 910 <xsl:attribute name="name"> 911 <xsl:value-of select="@id"/> 912 </xsl:attribute> 913 </xsl:if> 914 915 <xsl:attribute name="href"> 916 <xsl:call-template name="href.target"> 917 <xsl:with-param name="object" select="$target"/> 918 </xsl:call-template> 919 </xsl:attribute> 920 921 <xsl:call-template name="inline.italicseq"> 922 <xsl:with-param name="content" select="$content"/> 923 </xsl:call-template> 924 </a> 925 </xsl:otherwise> 926 </xsl:choose> 927 </xsl:when> 928 929 <xsl:otherwise> 930 <xsl:call-template name="inline.italicseq"/> 931 </xsl:otherwise> 932 </xsl:choose> 933</xsl:template> 934 935<xsl:template match="termdef"> 936 <span class="{local-name(.)}"> 937 <xsl:call-template name="generate.html.title"/> 938 <xsl:call-template name="gentext.template"> 939 <xsl:with-param name="context" select="'termdef'"/> 940 <xsl:with-param name="name" select="'prefix'"/> 941 </xsl:call-template> 942 <xsl:apply-templates/> 943 <xsl:call-template name="gentext.template"> 944 <xsl:with-param name="context" select="'termdef'"/> 945 <xsl:with-param name="name" select="'suffix'"/> 946 </xsl:call-template> 947 </span> 948</xsl:template> 949 950<xsl:template match="sgmltag|tag"> 951 <xsl:call-template name="format.sgmltag"/> 952</xsl:template> 953 954<xsl:template name="format.sgmltag"> 955 <xsl:param name="class"> 956 <xsl:choose> 957 <xsl:when test="@class"> 958 <xsl:value-of select="@class"/> 959 </xsl:when> 960 <xsl:otherwise>element</xsl:otherwise> 961 </xsl:choose> 962 </xsl:param> 963 964 <code class="sgmltag-{$class}"> 965 <xsl:call-template name="generate.html.title"/> 966 <xsl:choose> 967 <xsl:when test="$class='attribute'"> 968 <xsl:apply-templates/> 969 </xsl:when> 970 <xsl:when test="$class='attvalue'"> 971 <xsl:apply-templates/> 972 </xsl:when> 973 <xsl:when test="$class='element'"> 974 <xsl:apply-templates/> 975 </xsl:when> 976 <xsl:when test="$class='endtag'"> 977 <xsl:text></</xsl:text> 978 <xsl:apply-templates/> 979 <xsl:text>></xsl:text> 980 </xsl:when> 981 <xsl:when test="$class='genentity'"> 982 <xsl:text>&</xsl:text> 983 <xsl:apply-templates/> 984 <xsl:text>;</xsl:text> 985 </xsl:when> 986 <xsl:when test="$class='numcharref'"> 987 <xsl:text>&#</xsl:text> 988 <xsl:apply-templates/> 989 <xsl:text>;</xsl:text> 990 </xsl:when> 991 <xsl:when test="$class='paramentity'"> 992 <xsl:text>%</xsl:text> 993 <xsl:apply-templates/> 994 <xsl:text>;</xsl:text> 995 </xsl:when> 996 <xsl:when test="$class='pi'"> 997 <xsl:text><?</xsl:text> 998 <xsl:apply-templates/> 999 <xsl:text>></xsl:text> 1000 </xsl:when> 1001 <xsl:when test="$class='xmlpi'"> 1002 <xsl:text><?</xsl:text> 1003 <xsl:apply-templates/> 1004 <xsl:text>?></xsl:text> 1005 </xsl:when> 1006 <xsl:when test="$class='starttag'"> 1007 <xsl:text><</xsl:text> 1008 <xsl:apply-templates/> 1009 <xsl:text>></xsl:text> 1010 </xsl:when> 1011 <xsl:when test="$class='emptytag'"> 1012 <xsl:text><</xsl:text> 1013 <xsl:apply-templates/> 1014 <xsl:text>/></xsl:text> 1015 </xsl:when> 1016 <xsl:when test="$class='sgmlcomment' or $class='comment'"> 1017 <xsl:text><!--</xsl:text> 1018 <xsl:apply-templates/> 1019 <xsl:text>--></xsl:text> 1020 </xsl:when> 1021 <xsl:otherwise> 1022 <xsl:apply-templates/> 1023 </xsl:otherwise> 1024 </xsl:choose> 1025 </code> 1026</xsl:template> 1027 1028<xsl:template match="email"> 1029 <xsl:call-template name="inline.monoseq"> 1030 <xsl:with-param name="content"> 1031 <xsl:text><</xsl:text> 1032 <a> 1033 <xsl:attribute name="href">mailto:<xsl:value-of select="."/></xsl:attribute> 1034 <xsl:apply-templates/> 1035 </a> 1036 <xsl:text>></xsl:text> 1037 </xsl:with-param> 1038 </xsl:call-template> 1039</xsl:template> 1040 1041<xsl:template match="keycombo"> 1042 <xsl:variable name="action" select="@action"/> 1043 <xsl:variable name="joinchar"> 1044 <xsl:choose> 1045 <xsl:when test="$action='seq'"><xsl:text> </xsl:text></xsl:when> 1046 <xsl:when test="$action='simul'">+</xsl:when> 1047 <xsl:when test="$action='press'">-</xsl:when> 1048 <xsl:when test="$action='click'">-</xsl:when> 1049 <xsl:when test="$action='double-click'">-</xsl:when> 1050 <xsl:when test="$action='other'"></xsl:when> 1051 <xsl:otherwise>-</xsl:otherwise> 1052 </xsl:choose> 1053 </xsl:variable> 1054 <xsl:for-each select="*"> 1055 <xsl:if test="position()>1"><xsl:value-of select="$joinchar"/></xsl:if> 1056 <xsl:apply-templates select="."/> 1057 </xsl:for-each> 1058</xsl:template> 1059 1060<xsl:template match="uri"> 1061 <xsl:call-template name="inline.monoseq"/> 1062</xsl:template> 1063 1064<!-- ==================================================================== --> 1065 1066<xsl:template match="menuchoice"> 1067 <xsl:variable name="shortcut" select="./shortcut"/> 1068 <xsl:call-template name="process.menuchoice"/> 1069 <xsl:if test="$shortcut"> 1070 <xsl:text> (</xsl:text> 1071 <xsl:apply-templates select="$shortcut"/> 1072 <xsl:text>)</xsl:text> 1073 </xsl:if> 1074</xsl:template> 1075 1076<xsl:template name="process.menuchoice"> 1077 <xsl:param name="nodelist" select="guibutton|guiicon|guilabel|guimenu|guimenuitem|guisubmenu|interface"/><!-- not(shortcut) --> 1078 <xsl:param name="count" select="1"/> 1079 1080 <xsl:choose> 1081 <xsl:when test="$count>count($nodelist)"></xsl:when> 1082 <xsl:when test="$count=1"> 1083 <xsl:apply-templates select="$nodelist[$count=position()]"/> 1084 <xsl:call-template name="process.menuchoice"> 1085 <xsl:with-param name="nodelist" select="$nodelist"/> 1086 <xsl:with-param name="count" select="$count+1"/> 1087 </xsl:call-template> 1088 </xsl:when> 1089 <xsl:otherwise> 1090 <xsl:variable name="node" select="$nodelist[$count=position()]"/> 1091 <xsl:choose> 1092 <xsl:when test="name($node)='guimenuitem' 1093 or name($node)='guisubmenu'"> 1094 <xsl:value-of select="$menuchoice.menu.separator"/> 1095 </xsl:when> 1096 <xsl:otherwise> 1097 <xsl:value-of select="$menuchoice.separator"/> 1098 </xsl:otherwise> 1099 </xsl:choose> 1100 <xsl:apply-templates select="$node"/> 1101 <xsl:call-template name="process.menuchoice"> 1102 <xsl:with-param name="nodelist" select="$nodelist"/> 1103 <xsl:with-param name="count" select="$count+1"/> 1104 </xsl:call-template> 1105 </xsl:otherwise> 1106 </xsl:choose> 1107</xsl:template> 1108 1109<!-- ==================================================================== --> 1110 1111<xsl:template match="optional"> 1112 <xsl:value-of select="$arg.choice.opt.open.str"/> 1113 <xsl:call-template name="inline.charseq"/> 1114 <xsl:value-of select="$arg.choice.opt.close.str"/> 1115</xsl:template> 1116 1117<xsl:template match="citation"> 1118 <!-- todo: integrate with bibliography collection --> 1119 <xsl:variable name="targets" select="(//biblioentry | //bibliomixed)[abbrev = string(current())]"/> 1120 1121 <xsl:choose> 1122 <xsl:when test="$targets"> 1123 <xsl:call-template name="xref"> 1124 <xsl:with-param name="targets" select="$targets"/> 1125 </xsl:call-template> 1126 </xsl:when> 1127 <xsl:otherwise> 1128 <xsl:message> 1129 <xsl:text>Citation to nonexistent publication abbrev: </xsl:text> 1130 <xsl:value-of select="."/> 1131 </xsl:message> 1132 <xsl:text>[</xsl:text> 1133 <xsl:call-template name="inline.charseq"/> 1134 <xsl:text>]</xsl:text> 1135 </xsl:otherwise> 1136 </xsl:choose> 1137</xsl:template> 1138 1139<!-- ==================================================================== --> 1140 1141<xsl:template match="comment[&comment.block.parents;]|remark[&comment.block.parents;]"> 1142 <xsl:if test="$show.comments != 0"> 1143 <p class="remark"><i><xsl:call-template name="inline.charseq"/></i></p> 1144 </xsl:if> 1145</xsl:template> 1146 1147<xsl:template match="comment|remark"> 1148 <xsl:if test="$show.comments != 0"> 1149 <em><xsl:call-template name="inline.charseq"/></em> 1150 </xsl:if> 1151</xsl:template> 1152 1153<!-- ==================================================================== --> 1154 1155<xsl:template match="productname"> 1156 <xsl:call-template name="inline.charseq"/> 1157 <xsl:if test="@class"> 1158 <xsl:call-template name="dingbat"> 1159 <xsl:with-param name="dingbat" select="@class"/> 1160 </xsl:call-template> 1161 </xsl:if> 1162</xsl:template> 1163 1164<xsl:template match="productnumber"> 1165 <xsl:call-template name="inline.charseq"/> 1166</xsl:template> 1167 1168<!-- ==================================================================== --> 1169 1170<xsl:template match="pob|street|city|state|postcode|country|otheraddr"> 1171 <xsl:call-template name="inline.charseq"/> 1172</xsl:template> 1173 1174<xsl:template match="phone|fax"> 1175 <xsl:call-template name="inline.charseq"/> 1176</xsl:template> 1177 1178<!-- in Addresses, for example --> 1179<xsl:template match="honorific|firstname|surname|lineage|othername"> 1180 <xsl:call-template name="inline.charseq"/> 1181</xsl:template> 1182 1183<!-- ==================================================================== --> 1184 1185<xsl:template match="personname"> 1186 <xsl:call-template name="anchor"/> 1187 <xsl:call-template name="person.name"/> 1188</xsl:template> 1189 1190<!-- ==================================================================== --> 1191 1192<xsl:template match="beginpage"> 1193 <!-- does nothing; this *is not* markup to force a page break. --> 1194</xsl:template> 1195 1196</xsl:stylesheet> 1197 1198