1<?xml version="1.0" encoding="ISO-8859-1" ?> 2<!-- @(#)xslspec.xsl 1.3 99/01/11 SMI; Style Sheet for the XML and XSL Recommendations and Working Drafts; written by Eduardo Gutentag --> 3<!-- $Id$ Hacked by James Clark --> 4<!DOCTYPE xsl:stylesheet [ 5<!ENTITY copy "©"> 6<!ENTITY nbsp " "> 7]> 8<!-- XSL Style sheet, DTD omitted --> 9<xsl:stylesheet 10 version="1.0" 11 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 12 13<xsl:output method="html" doctype-public="-//W3C//DTD HTML 4.0 Transitional//EN"/> 14 15<xsl:param name="w3">http://www.w3.org/</xsl:param> 16<!-- 17++++++++++++++++++++++++ 18 19Inclusions 20 21++++++++++++++++++++++++ 22--> 23 24<xsl:template match="spec" mode="css"> 25<xsl:text>code { font-family: monospace }</xsl:text> 26</xsl:template> 27 28<!-- 29******************************************************************* 30 31Basic framework to format W3C specs (as in the XML spec) 32 33******************************************************************* 34--> 35 <xsl:template match="spec"> 36 <html> 37 <head> 38 <title> 39 <xsl:value-of select="header/title"/> 40 </title> 41 <link rel="stylesheet" type="text/css" 42 href="{$w3}StyleSheets/TR/W3C-{substring-before(header/w3c-designation,'-')}"/> 43 <!-- This stops Netscape 4.5 from messing up. --> 44 <style type="text/css"> 45 <xsl:apply-templates select="." mode="css"/> 46 </style> 47 </head> 48 <body> 49 <xsl:apply-templates/> 50 </body> 51 </html> 52 </xsl:template> 53<!-- 54******************************************************************* 55 56Prologue 57 58******************************************************************* 59--> 60 61 <xsl:template match="header"> 62 <div class="head"> 63 <a href="http://www.w3.org/"> 64 <img src="{$w3}Icons/WWW/w3c_home" 65 alt="W3C" height="48" width="72"/> 66 </a> 67 <h1> 68 <xsl:value-of select="title"/> 69 <br/> 70 <xsl:value-of select="version"/> 71 </h1> 72 <h2> 73 <xsl:value-of select="w3c-doctype"/> 74 <xsl:text> </xsl:text> 75 <xsl:value-of select="pubdate/day"/> 76 <xsl:text> </xsl:text> 77 <xsl:value-of select="pubdate/month"/> 78 <xsl:text> </xsl:text> 79 <xsl:value-of select="pubdate/year"/> 80 </h2> 81 <dl> 82 <xsl:apply-templates select="publoc"/> 83 <xsl:apply-templates select="latestloc"/> 84 <xsl:apply-templates select="prevlocs"/> 85 <xsl:apply-templates select="authlist"/> 86 </dl> 87 <xsl:call-template name="copyright"/> 88 <hr title="Separator for header"/> 89 </div> 90 <xsl:apply-templates select="abstract"/> 91 <xsl:apply-templates select="status"/> 92 </xsl:template> 93 94 <xsl:template match="publoc"> 95 <dt>This version:</dt> 96 <dd><xsl:apply-templates/></dd> 97 </xsl:template> 98 <xsl:template match="publoc/loc|latestloc/loc|prevlocs/loc"> 99 <a href="{@href}"><xsl:apply-templates/></a> 100 <br/> 101 </xsl:template> 102 <xsl:template match="latestloc"> 103 <dt>Latest version:</dt> 104 <dd><xsl:apply-templates/></dd> 105 </xsl:template> 106 107 <xsl:template match="prevlocs"> 108 <dt> 109 <xsl:text>Previous version</xsl:text> 110 <xsl:if test="count(loc)>1">s</xsl:if> 111 <xsl:text>:</xsl:text> 112 </dt> 113 <dd><xsl:apply-templates/></dd> 114 </xsl:template> 115 <xsl:template match="authlist"> 116 <dt> 117 <xsl:text>Editor</xsl:text> 118 <xsl:if test="count(author)>1">s</xsl:if> 119 <xsl:text>:</xsl:text> 120 </dt> 121 <dd> <xsl:apply-templates/></dd> 122 </xsl:template> 123 <xsl:template match="author"> 124 <xsl:apply-templates/> 125 <br/> 126 </xsl:template> 127 128 <xsl:template match="author/name"> 129 <xsl:apply-templates/> 130 </xsl:template> 131 132 <xsl:template match="author/affiliation"> 133 <xsl:text> (</xsl:text> 134 <xsl:apply-templates/> 135 <xsl:text>) </xsl:text> 136 </xsl:template> 137 138 <xsl:template match="author/email"> 139 <a href="{@href}"> 140 <xsl:text><</xsl:text> 141 <xsl:apply-templates/> 142 <xsl:text>></xsl:text> 143 </a> 144 </xsl:template> 145 146 <xsl:template match="abstract"> 147 <h2><a name="abstract">Abstract</a></h2> 148 <xsl:apply-templates/> 149 </xsl:template> 150 151 <xsl:template match="status"> 152 <h2><a name="status">Status of this document</a></h2> 153 <xsl:apply-templates/> 154 </xsl:template> 155 156<!-- 157******************************************************************* 158 159Real body work 160 161******************************************************************* 162--> 163 164 <xsl:template match="body"> 165 <h2><a name="contents">Table of contents</a></h2> 166 <xsl:call-template name="toc"/> 167 <hr/> 168 <xsl:apply-templates/> 169 </xsl:template> 170 171 <xsl:template match="back"> 172 <hr title="Separator from footer"/> 173 <xsl:apply-templates/> 174 </xsl:template> 175 176 <xsl:template match="div1/head|inform-div1/head"> 177 <h2><xsl:call-template name="head"/></h2> 178 </xsl:template> 179 180 <xsl:template match="div2/head"> 181 <h3><xsl:call-template name="head"/></h3> 182 </xsl:template> 183 184 <xsl:template match="div3/head"> 185 <h4><xsl:call-template name="head"/></h4> 186 </xsl:template> 187 188 <xsl:template match="div4/head"> 189 <h5><xsl:call-template name="head"/></h5> 190 </xsl:template> 191 192 <xsl:template name="head"> 193 <xsl:for-each select=".."> 194 <xsl:call-template name="insertID"/> 195 <xsl:apply-templates select="." mode="number"/> 196 </xsl:for-each> 197 <xsl:apply-templates/> 198 <xsl:call-template name="inform"/> 199 </xsl:template> 200 201<!-- 202******************************************************************* 203 204Blocks 205 206******************************************************************* 207--> 208 <xsl:template match="item/p" priority="1"> 209 <p> 210 <xsl:apply-templates/> 211 </p> 212 </xsl:template> 213 214 <xsl:template match="p"> 215 <p> 216 <xsl:apply-templates/> 217 </p> 218 </xsl:template> 219 220 221 <xsl:template match="eg"> 222 <pre> 223 <xsl:if test="@role='error'"> 224 <xsl:attribute name="style">color: red</xsl:attribute> 225 </xsl:if> 226 <xsl:apply-templates/> 227 </pre> 228 </xsl:template> 229 230 <xsl:template match="htable"> 231 <table border="{@border}" 232 cellpadding="{@cellpadding}" 233 align="{@align}"> 234 <xsl:apply-templates/> 235 </table> 236 </xsl:template> 237 238 <xsl:template match="htbody"> 239 <tbody> 240 <xsl:apply-templates/> 241 </tbody> 242 </xsl:template> 243 244 <xsl:template match="tr"> 245 <tr align="{@align}" 246 valign="{@valign}"> 247 <xsl:apply-templates/> 248 </tr> 249 </xsl:template> 250 251 <xsl:template match="td"> 252 <td bgcolor="{@bgcolor}" 253 rowspan="{@rowspan}" 254 colspan="{@colspan}" 255 align="{@align}" 256 valign="{@valign}"> 257 <xsl:apply-templates/> 258 </td> 259 </xsl:template> 260 261 <xsl:template match="ednote"> 262 <blockquote> 263 <p><b>Ed. Note: </b><xsl:apply-templates/></p> 264 </blockquote> 265 </xsl:template> 266 267 <xsl:template match="edtext"> 268 <xsl:apply-templates/> 269 </xsl:template> 270 271 <xsl:template match="issue"> 272 <xsl:call-template name="insertID"/> 273 <blockquote> 274 <p> 275 <b>Issue (<xsl:value-of select="substring-after(@id,'-')"/>): </b> 276 <xsl:apply-templates/> 277 </p> 278 </blockquote> 279 </xsl:template> 280 281 282 <xsl:template match="note"> 283 <blockquote> 284 <b>NOTE: </b> 285 <xsl:apply-templates/> 286 </blockquote> 287 </xsl:template> 288 289 <xsl:template match="issue/p|note/p"> 290 <xsl:apply-templates/> 291 </xsl:template> 292<!-- 293******************************************************************* 294 295Productions 296 297******************************************************************* 298--> 299 <xsl:template match="scrap"> 300 <xsl:if test="string(head)"> 301 <h5><xsl:value-of select="head"/></h5> 302 </xsl:if> 303 <table class="scrap"> 304 <tbody> 305 <xsl:apply-templates select="prodgroup|prod"/> 306 </tbody> 307 </table> 308 </xsl:template> 309 310 311 <xsl:template match="prod"> 312 <!-- select elements that start a row --> 313 <xsl:apply-templates select=" 314*[self::lhs 315 or ((self::vc or self::wfc or self::com) 316 and not(preceding-sibling::*[1][self::rhs])) 317 or (self::rhs 318 and not(preceding-sibling::*[1][self::lhs]))] 319"/> 320 </xsl:template> 321 322 <xsl:template match="lhs"> 323 <tr valign="baseline"> 324 <td><a name="{../@id}"/> 325 <xsl:number from="body" level="any" format="[1] "/> 326 </td> 327 <td><xsl:apply-templates/></td> 328 <td><xsl:text> ::= </xsl:text></td> 329 <xsl:for-each select="following-sibling::*[1]"> 330 <td><xsl:apply-templates mode="cell" select="."/></td> 331 <td><xsl:apply-templates mode="cell" select="following-sibling::*[1][self::vc or self::wfc or self::com]"/></td> 332 </xsl:for-each> 333 </tr> 334 </xsl:template> 335 336 <xsl:template match="rhs"> 337 <tr valign="baseline"> 338 <td></td> 339 <td></td> 340 <td></td> 341 <td><xsl:apply-templates mode="cell" select="."/></td> 342 <td><xsl:apply-templates mode="cell" select="following-sibling::*[1][self::vc or self::wfc or self::com]"/></td> 343 </tr> 344 </xsl:template> 345 346 <xsl:template match="vc|wfc|com"> 347 <tr valign="baseline"> 348 <td></td> 349 <td></td> 350 <td></td> 351 <td></td> 352 <td><xsl:apply-templates mode="cell" select="."/></td> 353 </tr> 354 </xsl:template> 355 356 357 <xsl:template match="prodgroup"> 358 <xsl:apply-templates/> 359 </xsl:template> 360 361 <xsl:template match="com" mode="cell"> 362 <xsl:text>/*</xsl:text> 363 <xsl:apply-templates/> 364 <xsl:text>*/</xsl:text> 365 </xsl:template> 366 367 <xsl:template match="rhs" mode="cell"> 368 <xsl:apply-templates/> 369 </xsl:template> 370 371 <xsl:template match="vc" mode="cell"> 372 <xsl:text>[ VC: </xsl:text> 373 <a href="#{@def}"> 374 <xsl:value-of select="id(@def)/head"/> 375 </a> 376 <xsl:text> ]</xsl:text> 377 <xsl:apply-templates/> 378 </xsl:template> 379 380 <xsl:template match="wfc" mode="cell"> 381 <xsl:text>[ WFC: </xsl:text> 382 <a href="#{@def}"> 383 <xsl:value-of select="id(@def)/head"/> 384 </a> 385 <xsl:text> ]</xsl:text> 386 <xsl:apply-templates/> 387 </xsl:template> 388<!-- 389******************************************************************* 390 391References 392 393******************************************************************* 394--> 395 <xsl:template match="p/loc" priority="1"> 396 <a href="{@href}"><xsl:apply-templates/></a> 397 </xsl:template> 398 399 <xsl:template match="publoc/loc|latestloc/loc|prevlocs/loc"> 400 <a href="{@href}"><xsl:apply-templates/></a> 401 <br/> 402 </xsl:template> 403 404 <xsl:template match="loc"> 405 <a href="{@href}"><xsl:apply-templates/></a> 406 </xsl:template> 407 408 409 <xsl:template match="bibref"> 410 <a href="#{@ref}"> 411 <xsl:text>[</xsl:text> 412 <xsl:value-of select="id(@ref)/@key"/> 413 <xsl:apply-templates/> 414 <xsl:text>]</xsl:text> 415 </a> 416 </xsl:template> 417 418 <xsl:template match="specref"> 419 <a href="#{@ref}"> 420 <xsl:text>[</xsl:text> 421 <b> 422 <xsl:for-each select="id(@ref)/head"> 423 <xsl:apply-templates select=".." mode="number"/> 424 <xsl:apply-templates/> 425 </xsl:for-each> 426 </b> 427 <xsl:apply-templates/> 428 <xsl:text>]</xsl:text> 429 </a> 430 </xsl:template> 431 <xsl:template match="xspecref|xtermref"> 432 <a href="{@href}"> 433 <xsl:apply-templates/> 434 </a> 435 </xsl:template> 436 <xsl:template match="termref"> 437 <a href="#{@def}"> 438 <xsl:apply-templates/> 439 </a> 440 </xsl:template> 441 442 <xsl:template match="titleref"> 443 <a href="#{@href}"> 444 <xsl:apply-templates/> 445 </a> 446 </xsl:template> 447 448 <xsl:template match="termdef"> 449 <a name="{@id}"> 450 </a> 451 <xsl:apply-templates/> 452 </xsl:template> 453 454 455 <xsl:template match="vcnote"> 456 <a name="{@id}"></a> 457 <p><b>Validity Constraint: <xsl:value-of select="head"/></b></p> 458 <xsl:apply-templates/> 459 </xsl:template> 460 461 <xsl:template match="wfcnote"> 462 <a name="{@id}"></a> 463 <p><b>Well Formedness Constraint: <xsl:value-of select="head"/></b></p> 464 <xsl:apply-templates/> 465 </xsl:template> 466 467<!-- 468******************************************************************* 469 470Inlines 471 472******************************************************************* 473--> 474 <xsl:template match="termdef"> 475 <a name="{@id}"> 476 </a> 477 <xsl:apply-templates/> 478 </xsl:template> 479 480 <xsl:template match="term"> 481 <b><xsl:apply-templates/></b> 482 </xsl:template> 483 484 <xsl:template match="orglist/member[1]" priority="2"> 485 <xsl:apply-templates select="*"/> 486 </xsl:template> 487 488 <xsl:template match="orglist/member"> 489 <xsl:text>; </xsl:text> 490 <xsl:apply-templates select="*"/> 491 </xsl:template> 492 493 <xsl:template match="orglist/member/affiliation"> 494 <xsl:text>, </xsl:text> 495 <xsl:apply-templates/> 496 </xsl:template> 497 <xsl:template match="orglist/member/role"> 498 <xsl:text> (</xsl:text> 499 <xsl:apply-templates/> 500 <xsl:text>)</xsl:text> 501 </xsl:template> 502 503 <xsl:template match="code"> 504 <code> 505 <xsl:apply-templates/> 506 </code> 507 </xsl:template> 508 509 <xsl:template match="emph"> 510 <i> 511 <xsl:apply-templates/> 512 </i> 513 </xsl:template> 514<!-- 515******************************************************************* 516 517Lists 518 519******************************************************************* 520--> 521 <xsl:template match="blist"> 522 <dl> 523 <xsl:apply-templates/> 524 </dl> 525 </xsl:template> 526 527 <xsl:template match="slist"> 528 <ul> 529 <xsl:apply-templates/> 530 </ul> 531 </xsl:template> 532 <xsl:template match="sitem"> 533 <li> 534 <xsl:apply-templates/> 535 </li> 536 </xsl:template> 537 538 <xsl:template match="blist/bibl"> 539 <dt> 540 <a name="{@id}"> 541 <xsl:value-of select="@key"/> 542 </a> 543 </dt> 544 <dd> 545 <xsl:apply-templates/> 546 </dd> 547 </xsl:template> 548 549 <xsl:template match="olist"> 550 <ol> 551 <xsl:apply-templates/> 552 </ol> 553 </xsl:template> 554 555 <xsl:template match="ulist"> 556 <!-- 557 <ul type="circle"> 558 --> 559 <ul> 560 <xsl:apply-templates/> 561 </ul> 562 </xsl:template> 563 564 <xsl:template match="glist"> 565 <dl> 566 <xsl:apply-templates/> 567 </dl> 568 </xsl:template> 569 570 <xsl:template match="item"> 571 <li> 572 <xsl:apply-templates/> 573 </li> 574 </xsl:template> 575 576 <xsl:template match="label"> 577 <dt> 578 <b><xsl:apply-templates/></b> 579 </dt> 580 </xsl:template> 581 582 <xsl:template match="def"> 583 <dd> 584 <xsl:apply-templates/> 585 </dd> 586 </xsl:template> 587 588 <xsl:template match="orglist"> 589 <xsl:apply-templates select="*"/> 590 </xsl:template> 591 592 593 <xsl:template match="olist"> 594 <ol> 595 <xsl:apply-templates/> 596 </ol> 597 </xsl:template> 598 599 600<!-- 601******************************************************************* 602 603Empty templates 604 605******************************************************************* 606--> 607 <xsl:template match="w3c-designation"> 608 </xsl:template> 609 610 <xsl:template match="w3c-doctype"> 611 </xsl:template> 612 613 <xsl:template match="header/pubdate"> 614 </xsl:template> 615 616 617 <xsl:template match="spec/header/title"> 618 </xsl:template> 619 620 <xsl:template match="revisiondesc"> 621 </xsl:template> 622 623 <xsl:template match="pubstmt"> 624 </xsl:template> 625 626 <xsl:template match="sourcedesc"> 627 </xsl:template> 628 629 <xsl:template match="langusage"> 630 </xsl:template> 631 632 <xsl:template match="version"> 633 </xsl:template> 634<!-- 635******************************************************************* 636 637Macros 638 639 640******************************************************************* 641--> 642 643 <xsl:template name="copyright"> 644 <p class="copyright"> 645 <a href="http://www.w3.org/Consortium/Legal/ipr-notice.html#Copyright"> 646 Copyright</a> © 1999 <a href="http://www.w3.org">W3C</a> 647 (<a href="http://www.lcs.mit.edu">MIT</a>, 648 <a href="http://www.inria.fr/">INRIA</a>, 649 <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C 650 <a href="http://www.w3.org/Consortium/Legal/ipr-notice.html#Legal_Disclaimer">liability</a>, 651 <a href="http://www.w3.org/Consortium/Legal/ipr-notice.html#W3C_Trademarks">trademark</a>, 652 <a href="http://www.w3.org/Consortium/Legal/copyright-documents.html">document use</a> and 653 <a href="http://www.w3.org/Consortium/Legal/copyright-software.html">software licensing</a> rules apply. 654 </p> 655 </xsl:template> 656 657 <xsl:template name="toc"> 658 <xsl:for-each select="/spec/body/div1"> 659 <xsl:call-template name="makeref"/> 660 <br/> 661 662 <xsl:for-each select="div2"> 663 <xsl:text> </xsl:text> 664 <xsl:call-template name="makeref"/> 665 <br/> 666 <xsl:for-each select="div3"> 667 <xsl:text> </xsl:text> 668 <xsl:call-template name="makeref"/> 669 <br/> 670 </xsl:for-each> 671 </xsl:for-each> 672 </xsl:for-each> 673 674 <h3>Appendices</h3> 675 676 <xsl:for-each select="/spec/back/div1 | /spec/back/inform-div1"> 677 <xsl:call-template name="makeref"/> 678 <br/> 679 680 <xsl:for-each select="div2"> 681 <xsl:text> </xsl:text> 682 <xsl:call-template name="makeref"/> 683 <br/> 684 685 <xsl:for-each select="div3"> 686 <xsl:text> </xsl:text> 687 <xsl:call-template name="makeref"/> 688 <br/> 689 </xsl:for-each> 690 </xsl:for-each> 691 </xsl:for-each> 692 </xsl:template> 693 694 <xsl:template name="insertID"> 695 <xsl:choose> 696 <xsl:when test="@id"> 697 <a name="{@id}"/> 698 </xsl:when> 699 <xsl:otherwise> 700 <a name="section-{translate(head,' ','-')}"/> 701 </xsl:otherwise> 702 </xsl:choose> 703 </xsl:template> 704 705 <xsl:template name="makeref"> 706 <xsl:apply-templates select="." mode="number"/> 707 <xsl:choose> 708 <xsl:when test="@id"> 709 <a href="#{@id}"> 710 <xsl:value-of select="head"/> 711 </a> 712 </xsl:when> 713 <xsl:otherwise> 714 <a href="#section-{translate(head,' ','-')}"> 715 <xsl:value-of select="head"/> 716 </a> 717 </xsl:otherwise> 718 </xsl:choose> 719 <xsl:for-each select="head"> 720 <xsl:call-template name="inform"/> 721 </xsl:for-each> 722 </xsl:template> 723 724 <xsl:template name="inform"> 725 <xsl:if test="parent::inform-div1"> 726 <xsl:text> (Non-Normative)</xsl:text> 727 </xsl:if> 728 </xsl:template> 729 730 <xsl:template match="nt"> 731 <a href="#{@def}"><xsl:apply-templates/></a> 732 </xsl:template> 733 734 <xsl:template match="xnt"> 735 <a href="{@href}"><xsl:apply-templates/></a> 736 </xsl:template> 737 738 <xsl:template match="quote"> 739 <xsl:text>"</xsl:text> 740 <xsl:apply-templates/> 741 <xsl:text>"</xsl:text> 742 </xsl:template> 743 744 <xsl:template mode="number" match="back//*"> 745 <xsl:number level="multiple" 746 count="inform-div1|div1|div2|div3|div4" 747 format="A.1 "/> 748 </xsl:template> 749 <xsl:template mode="number" match="*"> 750 <xsl:number level="multiple" 751 count="inform-div1|div1|div2|div3|div4" 752 format="1.1 "/> 753 </xsl:template> 754 755 756 <!-- 757 * Licensed to the Apache Software Foundation (ASF) under one 758 * or more contributor license agreements. See the NOTICE file 759 * distributed with this work for additional information 760 * regarding copyright ownership. The ASF licenses this file 761 * to you under the Apache License, Version 2.0 (the "License"); 762 * you may not use this file except in compliance with the License. 763 * You may obtain a copy of the License at 764 * 765 * http://www.apache.org/licenses/LICENSE-2.0 766 * 767 * Unless required by applicable law or agreed to in writing, software 768 * distributed under the License is distributed on an "AS IS" BASIS, 769 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 770 * See the License for the specific language governing permissions and 771 * limitations under the License. 772 --> 773 774</xsl:stylesheet> 775