home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2003 October / INTERNET108.ISO / pc / software / windows / building / xmlspy / xmlspyentcomplete5.exe / Data1.cab / _682DED78783549219C3B6CFF7D3E1BCC < prev    next >
Encoding:
Extensible Markup Language  |  2002-09-20  |  73.5 KB  |  2,209 lines

  1. <?xml version="1.0"?>
  2. <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:saxon="http://icl.com/saxon" exclude-result-prefixes="saxon" version="1.0">
  3.     <!-- ====================================================================== -->
  4.     <!-- xmlspec.xsl: An HTML XSL[1] Stylesheet for XML Spec V2.1[2] markup
  5.  
  6.      Version: $Id: xmlspec.xsl,v 1.1.2.1 2002/09/20 17:29:21 jdj Exp $
  7.  
  8.      URI:     http://dev.w3.org/cvsweb/spec-prod/html/xmlspec.xsl
  9.  
  10.      Authors: Norman Walsh (norman.walsh@sun.com)
  11.               Chris Maden (crism@lexica.net)
  12.               Ben Trafford (ben@legendary.org)
  13.               Eve Maler (eve.maler@sun.com)
  14.               Henry S. Thompson (ht@cogsci.ed.ac.uk)
  15.  
  16.      Date:    Created 07 September 1999
  17.               Last updated $Date: 2002/09/20 17:29:21 $ by $Author: jdj $
  18.  
  19.      Copyright (C) 2000, 2001, 2002 Sun Microsystems, Inc. All Rights Reserved.
  20.      This document is governed by the W3C Software License[3] as
  21.      described in the FAQ[4].
  22.  
  23.        [1] http://www.w3.org/TR/xslt
  24.        [2] http://www.w3.org/XML/1998/06/xmlspec-report-v21.htm
  25.        [3] http://www.w3.org/Consortium/Legal/copyright-software-19980720
  26.        [4] http://www.w3.org/Consortium/Legal/IPR-FAQ-20000620.html#DTD
  27.  
  28.      Notes:
  29.  
  30.      This stylesheet attempts to implement the XML Specification V2.1
  31.      DTD.  Documents conforming to earlier DTDs may not be correctly
  32.      transformed.
  33.  
  34.      ChangeLog: (See also: CVS ChangeLog)
  35.  
  36.      15 August 2002: Norman Walsh, <Norman.Walsh@Sun.COM>
  37.        - Version 1.3 released at http://www.w3.org/2002/xmlspec/html/1.3/xmlspec.xsl
  38.          There have never been any "official" releases before, so the version number
  39.          is arbitrary.
  40.  
  41.      15 August 2001: Hugo Haas <hugo@w3.org>
  42.        - Slightly modified the status sentence introducing editors'
  43.          copies.
  44.        - Now using role to distinguish editors' copies: e.g.
  45.          <spec w3c-doctype="wd" role="editors-copy">
  46.  
  47.      14 August 2001: Hugo Haas <hugo@w3.org>
  48.        - If w3c-doctype is not a W3C TR, do not use a Note style
  49.          sheet, use <http://www.w3.org/StyleSheets/TR/base.css>
  50.          instead.
  51.        - If the other-doctype is "editors-copy", do not use the W3C
  52.          logo and mark the document as such in the status section.
  53.  
  54.      12 Jun 2001: (Norman.Walsh@Sun.COM)
  55.        - Support non-tabular examples. If tabular.examples is non-zero,
  56.          tables will be used for examples, otherwise nested divs and
  57.          CSS will be used. tabular.examples is *zero* by default.
  58.  
  59.      06 Jun 2001: (Norman.Walsh@Sun.COM)
  60.        - Support copyright element in header; use the content of that
  61.          element if it is present, otherwise use the auto-generated
  62.          copyright statement.
  63.  
  64.      15 May 2001: (Norman.Walsh@Sun.COM)
  65.        - Changed copyright link to point to dated IPR statement:
  66.          http://www.w3.org/Consortium/Legal/ipr-notice-20000612
  67.  
  68.      25 Sep 2000: (Norman.Walsh@East.Sun.COM)
  69.        - Sync'd with Eve's version:
  70.          o Concatenated each inline element's output all on one line
  71.            to avoid spurious spaces in the output. (This is really an
  72.            IE bug, but...) (15 Sep 2000)
  73.          o Updated crism's email address in header (7 Sep 2000)
  74.          o Changed handling of affiliation to use comma instead of
  75.            parentheses (9 Aug 2000)
  76.  
  77.      14 Aug 2000: (Norman.Walsh@East.Sun.COM)
  78.  
  79.        - Added additional.title param (for diffspec.xsl to change)
  80.        - Fixed URI of W3C home icon
  81.        - Made CSS stylesheet selection depend on the w3c-doctype attribute
  82.          of spec instead of the w3c-doctype element in the header
  83.  
  84.      26 Jul 2000: (Norman.Walsh@East.Sun.COM)
  85.  
  86.        - Improved semantics of specref. Added xsl:message for unsupported
  87.          cases. (I'm by no means confident that I've covered the whole
  88.          list.)
  89.        - Support @role on author.
  90.        - Make lhs/rhs "code" in EBNF.
  91.        - Fixed bug in ID/IDREF linking.
  92.        - More effectively disabled special markup for showing @diffed
  93.          versions
  94.  
  95.      21 Jul 2000: (Norman.Walsh@East.Sun.COM)
  96.  
  97.        - Added support for @diff change tracking, primarily through
  98.          the auxiliary stylesheet diffspec.xsl. However, it was
  99.          impractical to handle some constructions, such as DLs and TABLEs,
  100.          in a completely out-of-band manner. So there is some inline
  101.          support for @diff markup.
  102.  
  103.        - Added $additional.css to allow downstream stylesheets to add
  104.          new markup to the <style> element.
  105.  
  106.        - Added required "type" attribute to the <style> element.
  107.  
  108.        - Fixed pervasive problem with nested <a> elements.
  109.  
  110.        - Added doctype-public to xsl:output.
  111.  
  112.        - Added $validity.hacks. If "1", then additional disable-output-escaping
  113.          markup may be inserted in some places to attempt to get proper,
  114.          valid HTML. For example, if a <glist> appears inside a <p> in the
  115.          xmlspec source, this creates a nested <dl> inside a <p> in the
  116.          HTML, which is not valid. If $validity.hacks is "1", then an
  117.          extra </p>, <p> pair is inserted around the <dl>.
  118.  
  119.    5 June 2001, Henry S. Thompson (ht@cogsci.ed.ac.uk)
  120.  
  121.        - Fixed a link in copyright boilerplate to be dated
  122.  
  123.   -->
  124.     <!-- ====================================================================== -->
  125.     <xsl:preserve-space elements="*"/>
  126.     <xsl:strip-space elements="
  127.    abstract arg attribute authlist author back bibref blist body case col
  128.    colgroup component constant constraint constraintnote copyright def
  129.    definitions descr div div1 div2 div3 div4 div5 ednote enum enumerator
  130.    example exception footnote front gitem glist graphic group header
  131.    htable htbody inform-div1 interface issue item itemizedlist langusage
  132.    listitem member method module note notice ol olist orderedlist orglist
  133.    param parameters prod prodgroup prodrecap proto pubdate pubstmt raises
  134.    reference resolution returns revisiondesc scrap sequence slist
  135.    sourcedesc spec specref status struct table tbody tfoot thead tr
  136.    typedef ul ulist union vc vcnote wfc wfcnote"/>
  137.     <xsl:param name="validity.hacks">1</xsl:param>
  138.     <xsl:param name="show.diff.markup">0</xsl:param>
  139.     <xsl:param name="additional.css"/>
  140.     <xsl:param name="additional.title"/>
  141.     <xsl:param name="called.by.diffspec">0</xsl:param>
  142.     <xsl:param name="show.ednotes">1</xsl:param>
  143.     <xsl:param name="tabular.examples">0</xsl:param>
  144.     <xsl:param name="toc.level" select="5"/>
  145.     <xsl:key name="ids" match="*[@id]" use="@id"/>
  146.     <xsl:key name="specrefs" match="specref" use="@ref"/>
  147.     <xsl:output method="html" encoding="ISO-8859-1" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" indent="no"/>
  148.     <xsl:strip-space elements="author"/>
  149.     <!-- not handled:
  150.     attribute:   unhandled IDL stuff
  151.     case:        unhandled IDL stuff
  152.     component:   unhandled IDL stuff
  153.     constant:    unhandled IDL stuff
  154.     copyright:   boilerplate notice always used instead
  155.     definitions: unhandled IDL stuff
  156.     descr:       unhandled IDL stuff
  157.     enum:        unhandled IDL stuff
  158.     enumerator:  unhandled IDL stuff
  159.     exception:   unhandled IDL stuff
  160.     group:       unhandled IDL stuff
  161.     interface:   unhandled IDL stuff
  162.     method:      unhandled IDL stuff
  163.     module:      unhandled IDL stuff
  164.     param:       unhandled IDL stuff
  165.     parameters:  unhandled IDL stuff
  166.     raises:      unhandled IDL stuff
  167.     reference:   unhandled IDL stuff
  168.     returns:     unhandled IDL stuff
  169.     sequence:    unhandled IDL stuff
  170.     struct:      unhandled IDL stuff
  171.     typedef:     unhandled IDL stuff
  172.     typename:    unhandled IDL stuff
  173.     union:       unhandled IDL stuff
  174.  
  175.     Warning!
  176.     Only handles statuses of NOTE, WD, and REC.
  177.     -->
  178.     <!-- Output a warning for unhandled elements! -->
  179.     <xsl:template match="*">
  180.         <xsl:message>
  181.             <xsl:text>No template matches </xsl:text>
  182.             <xsl:value-of select="name(.)"/>
  183.             <xsl:text>.</xsl:text>
  184.         </xsl:message>
  185.         <font color="red">
  186.             <xsl:text><</xsl:text>
  187.             <xsl:value-of select="name(.)"/>
  188.             <xsl:text>></xsl:text>
  189.             <xsl:apply-templates/>
  190.             <xsl:text></</xsl:text>
  191.             <xsl:value-of select="name(.)"/>
  192.             <xsl:text>></xsl:text>
  193.         </font>
  194.     </xsl:template>
  195.     <!-- Template for the root node.  Creation of <html> element could
  196.        go here, but that doesn't feel right. -->
  197.     <xsl:template match="/">
  198.         <xsl:apply-templates/>
  199.     </xsl:template>
  200.     <!-- abstract: appears only in header -->
  201.     <!-- format as a second-level div -->
  202.     <!-- called in enforced order from header's template -->
  203.     <xsl:template match="abstract">
  204.         <div>
  205.             <xsl:text> </xsl:text>
  206.             <h2>
  207.                 <xsl:call-template name="anchor">
  208.                     <xsl:with-param name="conditional" select="0"/>
  209.                     <xsl:with-param name="default.id" select="'abstract'"/>
  210.                 </xsl:call-template>
  211.                 <xsl:text>Abstract</xsl:text>
  212.             </h2>
  213.             <xsl:apply-templates/>
  214.         </div>
  215.     </xsl:template>
  216.     <!-- affiliation: follows a name in author and member -->
  217.     <!-- put it in parens with a leading space -->
  218.     <xsl:template match="affiliation">
  219.         <xsl:text>, </xsl:text>
  220.         <xsl:apply-templates/>
  221.     </xsl:template>
  222.     <!-- arg: appears only in proto -->
  223.     <!-- argument in function prototype -->
  224.     <!-- output argument type, italicized as placeholder; separate the
  225.        list with commas and spaces -->
  226.     <xsl:template match="arg">
  227.         <xsl:if test="preceding-sibling::arg">
  228.             <xsl:text>, </xsl:text>
  229.         </xsl:if>
  230.         <var>
  231.             <xsl:value-of select="@type"/>
  232.         </var>
  233.         <xsl:if test="@occur = 'opt'">
  234.             <xsl:text>?</xsl:text>
  235.         </xsl:if>
  236.     </xsl:template>
  237.     <!-- att: attribute name -->
  238.     <!-- used lots of places -->
  239.     <!-- format as monospaced code -->
  240.     <xsl:template match="att">
  241.         <code>
  242.             <xsl:apply-templates/>
  243.         </code>
  244.     </xsl:template>
  245.     <!-- attribute: -->
  246.     <!-- IDL stuff isn't handled yet -->
  247.     <!-- attval: attribute name -->
  248.     <!-- used lots of places -->
  249.     <!-- format as quoted string -->
  250.     <xsl:template match="attval">
  251.         <xsl:text>"</xsl:text>
  252.         <xsl:apply-templates/>
  253.         <xsl:text>"</xsl:text>
  254.     </xsl:template>
  255.     <!-- authlist: list of authors (editors, really) -->
  256.     <!-- called in enforced order from header's template, in <dl>
  257.        context -->
  258.     <xsl:template match="authlist">
  259.         <dt>
  260.             <xsl:text>Editor</xsl:text>
  261.             <xsl:if test="count(author) > 1">
  262.                 <xsl:text>s</xsl:text>
  263.             </xsl:if>
  264.             <xsl:text>:</xsl:text>
  265.         </dt>
  266.         <xsl:apply-templates/>
  267.     </xsl:template>
  268.     <!-- author: an editor of a spec -->
  269.     <!-- only appears in authlist -->
  270.     <!-- called in <dl> context -->
  271.     <xsl:template match="author">
  272.         <dd>
  273.             <xsl:apply-templates/>
  274.             <xsl:if test="@role = '2e'">
  275.                 <xsl:text> - Second Edition</xsl:text>
  276.             </xsl:if>
  277.         </dd>
  278.     </xsl:template>
  279.     <!-- back: back matter for the spec -->
  280.     <!-- make a <div> for neatness -->
  281.     <!-- affects numbering of div1 children -->
  282.     <xsl:template match="back">
  283.         <div class="back">
  284.             <xsl:apply-templates/>
  285.         </div>
  286.     </xsl:template>
  287.     <!-- bibl: bibliographic entry -->
  288.     <!-- only appears in blist -->
  289.     <!-- called with <dl> context -->
  290.     <!-- if there's a key, use it in the <dt>, otherwise use the ID -->
  291.     <!-- if there's an href, add a ref in parens at the end of the text -->
  292.     <xsl:template match="bibl">
  293.         <dt class="label">
  294.             <xsl:if test="@id">
  295.                 <a name="{@id}" id="{@id}"/>
  296.             </xsl:if>
  297.             <xsl:choose>
  298.                 <xsl:when test="@key">
  299.                     <xsl:value-of select="@key"/>
  300.                 </xsl:when>
  301.                 <xsl:otherwise>
  302.                     <xsl:value-of select="@id"/>
  303.                 </xsl:otherwise>
  304.             </xsl:choose>
  305.         </dt>
  306.         <dd>
  307.             <xsl:choose>
  308.                 <xsl:when test="@href">
  309.                     <a href="{@href}">
  310.                         <xsl:apply-templates/>
  311.                     </a>
  312.                 </xsl:when>
  313.                 <xsl:otherwise>
  314.                     <xsl:apply-templates/>
  315.                 </xsl:otherwise>
  316.             </xsl:choose>
  317.             <xsl:if test="@href">
  318.                 <xsl:text>  (See </xsl:text>
  319.                 <xsl:value-of select="@href"/>
  320.                 <xsl:text>.)</xsl:text>
  321.             </xsl:if>
  322.         </dd>
  323.     </xsl:template>
  324.     <!-- bibref: reference to a bibliographic entry -->
  325.     <!-- make a link to the bibl -->
  326.     <!-- if the bibl has a key, put it in square brackets; otherwise use
  327.        the bibl's ID -->
  328.     <xsl:template match="bibref">
  329.         <a>
  330.             <xsl:attribute name="href"><xsl:call-template name="href.target"><xsl:with-param name="target" select="key('ids', @ref)"/></xsl:call-template></xsl:attribute>
  331.             <xsl:text>[</xsl:text>
  332.             <xsl:choose>
  333.                 <xsl:when test="key('ids', @ref)/@key">
  334.                     <xsl:value-of select="key('ids', @ref)/@key"/>
  335.                 </xsl:when>
  336.                 <xsl:otherwise>
  337.                     <xsl:value-of select="@ref"/>
  338.                 </xsl:otherwise>
  339.             </xsl:choose>
  340.             <xsl:text>]</xsl:text>
  341.         </a>
  342.     </xsl:template>
  343.     <!-- blist: list of bibliographic entries -->
  344.     <!-- set up the list and process children -->
  345.     <xsl:template match="blist">
  346.         <dl>
  347.             <xsl:apply-templates/>
  348.         </dl>
  349.     </xsl:template>
  350.     <!-- bnf: un-marked-up BNF productions -->
  351.     <!-- preformatted within a table cell -->
  352.     <!-- scrap provides <table> context -->
  353.     <xsl:template match="bnf">
  354.         <tbody>
  355.             <tr>
  356.                 <td>
  357.                     <xsl:if test="@diff and $show.diff.markup='1'">
  358.                         <xsl:attribute name="class"><xsl:text>diff-</xsl:text><xsl:value-of select="@diff"/></xsl:attribute>
  359.                     </xsl:if>
  360.                     <pre>
  361.                         <xsl:apply-templates/>
  362.                     </pre>
  363.                 </td>
  364.             </tr>
  365.         </tbody>
  366.     </xsl:template>
  367.     <!-- body: the meat of the spec -->
  368.     <!-- create a TOC and then go to work -->
  369.     <!-- (don't forget the TOC for the back matter and a pointer to end
  370.        notes) -->
  371.     <xsl:template match="body">
  372.         <xsl:if test="$toc.level > 0">
  373.             <div class="toc">
  374.                 <xsl:text> </xsl:text>
  375.                 <h2>
  376.                     <xsl:call-template name="anchor">
  377.                         <xsl:with-param name="conditional" select="0"/>
  378.                         <xsl:with-param name="default.id" select="'contents'"/>
  379.                     </xsl:call-template>
  380.                     <xsl:text>Table of Contents</xsl:text>
  381.                 </h2>
  382.                 <p class="toc">
  383.                     <xsl:apply-templates select="div1" mode="toc"/>
  384.                 </p>
  385.                 <xsl:if test="../back">
  386.                     <xsl:text> </xsl:text>
  387.                     <h3>
  388.                         <xsl:call-template name="anchor">
  389.                             <xsl:with-param name="conditional" select="0"/>
  390.                             <xsl:with-param name="default.id" select="'appendices'"/>
  391.                         </xsl:call-template>
  392.                         <xsl:text>Appendi</xsl:text>
  393.                         <xsl:choose>
  394.                             <xsl:when test="count(../back/div1 | ../back/inform-div1) > 1">
  395.                                 <xsl:text>ces</xsl:text>
  396.                             </xsl:when>
  397.                             <xsl:otherwise>
  398.                                 <xsl:text>x</xsl:text>
  399.                             </xsl:otherwise>
  400.                         </xsl:choose>
  401.                     </h3>
  402.                     <p class="toc">
  403.                         <xsl:apply-templates mode="toc" select="../back/div1 | ../back/inform-div1"/>
  404.                     </p>
  405.                 </xsl:if>
  406.                 <xsl:if test="//footnote[not(ancestor::table)]">
  407.                     <p class="toc">
  408.                         <a href="#endnotes">
  409.                             <xsl:text>End Notes</xsl:text>
  410.                         </a>
  411.                     </p>
  412.                 </xsl:if>
  413.             </div>
  414.             <hr/>
  415.         </xsl:if>
  416.         <div class="body">
  417.             <xsl:apply-templates/>
  418.         </div>
  419.     </xsl:template>
  420.     <!-- caption: see table -->
  421.     <!-- case: -->
  422.     <!-- IDL stuff isn't handled yet -->
  423.     <!-- code: generic computer code -->
  424.     <!-- output as HTML <code> for monospaced formatting -->
  425.     <xsl:template match="code">
  426.         <code>
  427.             <xsl:apply-templates/>
  428.         </code>
  429.     </xsl:template>
  430.     <!-- col: see table -->
  431.     <!-- colgroup: see table -->
  432.     <!-- com: formal production comment -->
  433.     <!-- can appear in prod or rhs -->
  434.     <xsl:template match="com">
  435.         <xsl:choose>
  436.             <xsl:when test="preceding-sibling::*[1][name()='rhs']">
  437.                 <td>
  438.                     <xsl:if test="ancestor-or-self::*/@diff and $show.diff.markup='1'">
  439.                         <xsl:attribute name="class"><xsl:text>diff-</xsl:text><xsl:value-of select="ancestor-or-self::*/@diff"/></xsl:attribute>
  440.                     </xsl:if>
  441.                     <i>
  442.                         <xsl:text>/* </xsl:text>
  443.                         <xsl:apply-templates/>
  444.                         <xsl:text> */</xsl:text>
  445.                     </i>
  446.                 </td>
  447.             </xsl:when>
  448.             <xsl:otherwise>
  449.                 <tr valign="baseline">
  450.                     <td/>
  451.                     <td/>
  452.                     <td/>
  453.                     <td/>
  454.                     <td>
  455.                         <xsl:if test="ancestor-or-self::*/@diff and $show.diff.markup='1'">
  456.                             <xsl:attribute name="class"><xsl:text>diff-</xsl:text><xsl:value-of select="ancestor-or-self::*/@diff"/></xsl:attribute>
  457.                         </xsl:if>
  458.                         <i>
  459.                             <xsl:text>/* </xsl:text>
  460.                             <xsl:apply-templates/>
  461.                             <xsl:text> */</xsl:text>
  462.                         </i>
  463.                     </td>
  464.                 </tr>
  465.             </xsl:otherwise>
  466.         </xsl:choose>
  467.     </xsl:template>
  468.     <!-- this could probably be handled better, but given that rhs can
  469.        have arbitrary text and com mixed in, I don't feel like
  470.        spending enough time to figure out how -->
  471.     <xsl:template match="rhs/com">
  472.         <i>
  473.             <xsl:text>/* </xsl:text>
  474.             <xsl:apply-templates/>
  475.             <xsl:text> */</xsl:text>
  476.         </i>
  477.     </xsl:template>
  478.     <!-- component: -->
  479.     <!-- IDL stuff isn't handled yet -->
  480.     <!-- constant: -->
  481.     <!-- IDL stuff isn't handled yet -->
  482.     <!-- constraint: a note in a formal production -->
  483.     <!-- refers to a constraint note -->
  484.     <xsl:template match="constraint">
  485.         <xsl:choose>
  486.             <xsl:when test="preceding-sibling::*[1][name()='rhs']">
  487.                 <td>
  488.                     <xsl:if test="@diff and $show.diff.markup='1'">
  489.                         <xsl:attribute name="class"><xsl:text>diff-</xsl:text><xsl:value-of select="@diff"/></xsl:attribute>
  490.                     </xsl:if>
  491.                     <a>
  492.                         <xsl:attribute name="href"><xsl:call-template name="href.target"><xsl:with-param name="target" select="key('ids', @def)"/></xsl:call-template></xsl:attribute>
  493.                         <xsl:text>[Constraint: </xsl:text>
  494.                         <xsl:apply-templates select="key('ids', @def)/head" mode="text"/>
  495.                         <xsl:text>]</xsl:text>
  496.                     </a>
  497.                 </td>
  498.             </xsl:when>
  499.             <xsl:otherwise>
  500.                 <tr valign="baseline">
  501.                     <td/>
  502.                     <td/>
  503.                     <td/>
  504.                     <td/>
  505.                     <td>
  506.                         <xsl:if test="@diff and $show.diff.markup='1'">
  507.                             <xsl:attribute name="class"><xsl:text>diff-</xsl:text><xsl:value-of select="@diff"/></xsl:attribute>
  508.                         </xsl:if>
  509.                         <a>
  510.                             <xsl:attribute name="href"><xsl:call-template name="href.target"><xsl:with-param name="target" select="key('ids', @def)"/></xsl:call-template></xsl:attribute>
  511.                             <xsl:text>[Constraint: </xsl:text>
  512.                             <xsl:apply-templates select="key('ids', @def)/head" mode="text"/>
  513.                             <xsl:text>]</xsl:text>
  514.                         </a>
  515.                     </td>
  516.                 </tr>
  517.             </xsl:otherwise>
  518.         </xsl:choose>
  519.     </xsl:template>
  520.     <!-- constraintnote: note constraining a formal production -->
  521.     <!-- see also constraintnote/head -->
  522.     <xsl:template match="constraintnote">
  523.         <div class="constraint">
  524.             <xsl:apply-templates/>
  525.         </div>
  526.     </xsl:template>
  527.     <!-- copyright: notice for this document-->
  528.     <!-- right now, a boilerplate copyright notice is inserted by the
  529.        template for header; this may need to be changed -->
  530.     <!-- day: day of month of spec -->
  531.     <!-- only used in pudate; called directly from header template -->
  532.     <xsl:template match="day">
  533.         <xsl:apply-templates/>
  534.     </xsl:template>
  535.     <!-- def: glossary definition -->
  536.     <!-- already in <dl> context from glist -->
  537.     <xsl:template match="def">
  538.         <dd>
  539.             <xsl:apply-templates/>
  540.         </dd>
  541.     </xsl:template>
  542.     <!-- definitions: -->
  543.     <!-- IDL stuff isn't handled yet -->
  544.     <!-- descr: -->
  545.     <!-- IDL stuff isn't handled yet -->
  546.     <!-- div[n]: structural divisions -->
  547.     <!-- make an HTML div -->
  548.     <!-- see also div[n]/head -->
  549.     <xsl:template match="div1">
  550.         <div class="div1">
  551.             <xsl:apply-templates/>
  552.         </div>
  553.     </xsl:template>
  554.     <xsl:template match="div2">
  555.         <div class="div2">
  556.             <xsl:apply-templates/>
  557.         </div>
  558.     </xsl:template>
  559.     <xsl:template match="div3">
  560.         <div class="div3">
  561.             <xsl:apply-templates/>
  562.         </div>
  563.     </xsl:template>
  564.     <xsl:template match="div4">
  565.         <div class="div4">
  566.             <xsl:apply-templates/>
  567.         </div>
  568.     </xsl:template>
  569.     <xsl:template match="div5">
  570.         <div class="div5">
  571.             <xsl:apply-templates/>
  572.         </div>
  573.     </xsl:template>
  574.     <!-- ednote: editors' note -->
  575.     <xsl:template match="ednote">
  576.         <xsl:if test="$show.ednotes != 0">
  577.             <table border="1">
  578.                 <xsl:attribute name="summary"><xsl:text>Editorial note</xsl:text><xsl:if test="name"><xsl:text>: </xsl:text><xsl:value-of select="name"/></xsl:if></xsl:attribute>
  579.                 <tr>
  580.                     <td align="left" valign="top" width="50%">
  581.                         <b>
  582.                             <xsl:text>Editorial note</xsl:text>
  583.                             <xsl:if test="name">
  584.                                 <xsl:text>: </xsl:text>
  585.                                 <xsl:apply-templates select="name"/>
  586.                             </xsl:if>
  587.                         </b>
  588.                     </td>
  589.                     <td align="right" valign="top" width="50%">
  590.                         <xsl:choose>
  591.                             <xsl:when test="date">
  592.                                 <xsl:apply-templates select="date"/>
  593.                             </xsl:when>
  594.                             <xsl:otherwise> </xsl:otherwise>
  595.                         </xsl:choose>
  596.                     </td>
  597.                 </tr>
  598.                 <tr>
  599.                     <td colspan="2" align="left" valign="top">
  600.                         <xsl:apply-templates select="edtext"/>
  601.                     </td>
  602.                 </tr>
  603.             </table>
  604.         </xsl:if>
  605.     </xsl:template>
  606.     <xsl:template match="date">
  607.         <xsl:apply-templates/>
  608.     </xsl:template>
  609.     <!-- edtext: text of an editors' note -->
  610.     <!-- ednote is currently hidden -->
  611.     <!-- el: an XML element -->
  612.     <!-- present as preformatted text, no markup -->
  613.     <!-- Chris's personal preference is to put pointy-brackets around
  614.        this, but he seems to be in the minority -->
  615.     <xsl:template match="el">
  616.         <code>
  617.             <xsl:apply-templates/>
  618.         </code>
  619.     </xsl:template>
  620.     <!-- email: an email address for an editor -->
  621.     <!-- only occurs in author -->
  622.     <xsl:template match="email">
  623.         <xsl:text> </xsl:text>
  624.         <a href="{@href}">
  625.             <xsl:text><</xsl:text>
  626.             <xsl:apply-templates/>
  627.             <xsl:text>></xsl:text>
  628.         </a>
  629.     </xsl:template>
  630.     <!-- emph: in-line emphasis -->
  631.     <!-- equates to HTML <em> -->
  632.     <!-- the role attribute could be used for multiple kinds of
  633.        emphasis, but that would not be kind -->
  634.     <xsl:template match="emph">
  635.         <em>
  636.             <xsl:apply-templates/>
  637.         </em>
  638.     </xsl:template>
  639.     <!-- enum: -->
  640.     <!-- IDL stuff isn't handled yet -->
  641.     <!-- enumerator: -->
  642.     <!-- IDL stuff isn't handled yet -->
  643.     <!-- example: what it seems -->
  644.     <!-- block-level with title -->
  645.     <!-- see also example/head -->
  646.     <xsl:template match="example">
  647.         <xsl:variable name="class">
  648.             <xsl:choose>
  649.                 <xsl:when test="$tabular.examples = 0">exampleOuter</xsl:when>
  650.                 <xsl:otherwise>example</xsl:otherwise>
  651.             </xsl:choose>
  652.         </xsl:variable>
  653.         <div class="{$class}">
  654.             <xsl:apply-templates/>
  655.         </div>
  656.     </xsl:template>
  657.     <xsl:template match="example/head">
  658.         <xsl:text> </xsl:text>
  659.         <xsl:choose>
  660.             <xsl:when test="$tabular.examples = 0">
  661.                 <div class="exampleHead">
  662.                     <xsl:text>Example: </xsl:text>
  663.                     <xsl:apply-templates/>
  664.                 </div>
  665.             </xsl:when>
  666.             <xsl:otherwise>
  667.                 <h5>
  668.                     <xsl:call-template name="anchor">
  669.                         <xsl:with-param name="node" select=".."/>
  670.                         <xsl:with-param name="conditional" select="0"/>
  671.                     </xsl:call-template>
  672.                     <xsl:text>Example: </xsl:text>
  673.                     <xsl:apply-templates/>
  674.                 </h5>
  675.             </xsl:otherwise>
  676.         </xsl:choose>
  677.     </xsl:template>
  678.     <!-- eg: a literal example -->
  679.     <!-- present as preformatted text -->
  680.     <xsl:template match="eg">
  681.         <xsl:variable name="content">
  682.             <pre>
  683.                 <xsl:if test="@diff and $show.diff.markup='1'">
  684.                     <xsl:attribute name="class"><xsl:text>diff-</xsl:text><xsl:value-of select="@diff"/></xsl:attribute>
  685.                 </xsl:if>
  686.                 <xsl:apply-templates/>
  687.             </pre>
  688.         </xsl:variable>
  689.         <xsl:choose>
  690.             <xsl:when test="$tabular.examples = 0">
  691.                 <div class="exampleInner">
  692.                     <xsl:copy-of select="$content"/>
  693.                 </div>
  694.             </xsl:when>
  695.             <xsl:otherwise>
  696.                 <table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example">
  697.                     <tr>
  698.                         <td>
  699.                             <xsl:copy-of select="$content"/>
  700.                         </td>
  701.                     </tr>
  702.                 </table>
  703.             </xsl:otherwise>
  704.         </xsl:choose>
  705.     </xsl:template>
  706.     <!-- exception: -->
  707.     <!-- IDL stuff isn't handled yet -->
  708.     <!-- footnote: format as endnote, actually -->
  709.     <xsl:template match="footnote">
  710.         <xsl:variable name="this-note-id">
  711.             <xsl:choose>
  712.                 <xsl:when test="@id">
  713.                     <xsl:value-of select="@id"/>
  714.                 </xsl:when>
  715.                 <xsl:otherwise>
  716.                     <xsl:value-of select="generate-id(.)"/>
  717.                 </xsl:otherwise>
  718.             </xsl:choose>
  719.         </xsl:variable>
  720.         <sup>
  721.             <xsl:text>[</xsl:text>
  722.             <a name="FN-ANCH-{$this-note-id}" id="FN-ANCH-{$this-note-id}" href="#{$this-note-id}">
  723.                 <xsl:apply-templates select="." mode="number-simple"/>
  724.             </a>
  725.             <xsl:text>]</xsl:text>
  726.         </sup>
  727.     </xsl:template>
  728.     <!-- front: front matter for the spec -->
  729.     <!-- make a div for cleanliness -->
  730.     <xsl:template match="front">
  731.         <div class="front">
  732.             <xsl:apply-templates/>
  733.         </div>
  734.     </xsl:template>
  735.     <!-- function: name of a function -->
  736.     <!-- format as HTML <code> for monospaced presentation -->
  737.     <xsl:template match="function">
  738.         <code>
  739.             <xsl:apply-templates/>
  740.         </code>
  741.     </xsl:template>
  742.     <!-- gitem: glossary list entry -->
  743.     <!-- just pass children through for <dd>/<dt> formatting -->
  744.     <xsl:template match="gitem">
  745.         <xsl:apply-templates/>
  746.     </xsl:template>
  747.     <!-- glist: glossary list -->
  748.     <!-- create <dl> and handle children -->
  749.     <xsl:template match="glist">
  750.         <xsl:if test="$validity.hacks and local-name(..) = 'p'">
  751.             <xsl:text disable-output-escaping="yes"></p></xsl:text>
  752.         </xsl:if>
  753.         <dl>
  754.             <xsl:apply-templates/>
  755.         </dl>
  756.         <xsl:if test="$validity.hacks and local-name(..) = 'p'">
  757.             <xsl:text disable-output-escaping="yes"><p></xsl:text>
  758.         </xsl:if>
  759.     </xsl:template>
  760.     <!-- graphic: external illustration -->
  761.     <!-- reference external graphic file with alt text -->
  762.     <xsl:template match="graphic">
  763.         <img src="{@source}">
  764.             <xsl:if test="@alt">
  765.                 <xsl:attribute name="alt"><xsl:value-of select="@alt"/></xsl:attribute>
  766.             </xsl:if>
  767.         </img>
  768.     </xsl:template>
  769.     <!-- group: -->
  770.     <!-- IDL stuff isn't handled yet -->
  771.     <!-- head: title for a variety of constructs -->
  772.     <!-- constraintnotes have different types, but they're
  773.        non-enumerated; nothing is done with them right now -->
  774.     <xsl:template match="constraintnote/head">
  775.         <p class="prefix">
  776.             <xsl:if test="../@id">
  777.                 <a name="{../@id}" id="{../@id}"/>
  778.             </xsl:if>
  779.             <b>
  780.                 <xsl:text>Constraint: </xsl:text>
  781.                 <xsl:apply-templates/>
  782.             </b>
  783.         </p>
  784.     </xsl:template>
  785.     <xsl:template match="div1/head">
  786.         <xsl:text> </xsl:text>
  787.         <h2>
  788.             <xsl:call-template name="anchor">
  789.                 <xsl:with-param name="conditional" select="0"/>
  790.                 <xsl:with-param name="node" select=".."/>
  791.             </xsl:call-template>
  792.             <xsl:apply-templates select=".." mode="divnum"/>
  793.             <xsl:apply-templates/>
  794.         </h2>
  795.     </xsl:template>
  796.     <xsl:template match="div2/head">
  797.         <xsl:text> </xsl:text>
  798.         <h3>
  799.             <xsl:call-template name="anchor">
  800.                 <xsl:with-param name="conditional" select="0"/>
  801.                 <xsl:with-param name="node" select=".."/>
  802.             </xsl:call-template>
  803.             <xsl:apply-templates select=".." mode="divnum"/>
  804.             <xsl:apply-templates/>
  805.         </h3>
  806.     </xsl:template>
  807.     <xsl:template match="div3/head">
  808.         <xsl:text> </xsl:text>
  809.         <h4>
  810.             <xsl:call-template name="anchor">
  811.                 <xsl:with-param name="conditional" select="0"/>
  812.                 <xsl:with-param name="node" select=".."/>
  813.             </xsl:call-template>
  814.             <xsl:apply-templates select=".." mode="divnum"/>
  815.             <xsl:apply-templates/>
  816.         </h4>
  817.     </xsl:template>
  818.     <xsl:template match="div4/head">
  819.         <xsl:text> </xsl:text>
  820.         <h5>
  821.             <xsl:call-template name="anchor">
  822.                 <xsl:with-param name="conditional" select="0"/>
  823.                 <xsl:with-param name="node" select=".."/>
  824.             </xsl:call-template>
  825.             <xsl:apply-templates select=".." mode="divnum"/>
  826.             <xsl:apply-templates/>
  827.         </h5>
  828.     </xsl:template>
  829.     <xsl:template match="div5/head">
  830.         <xsl:text> </xsl:text>
  831.         <h6>
  832.             <xsl:call-template name="anchor">
  833.                 <xsl:with-param name="conditional" select="0"/>
  834.                 <xsl:with-param name="node" select=".."/>
  835.             </xsl:call-template>
  836.             <xsl:apply-templates select=".." mode="divnum"/>
  837.             <xsl:apply-templates/>
  838.         </h6>
  839.     </xsl:template>
  840.     <xsl:template match="inform-div1/head">
  841.         <xsl:text> </xsl:text>
  842.         <h2>
  843.             <xsl:call-template name="anchor">
  844.                 <xsl:with-param name="conditional" select="0"/>
  845.                 <xsl:with-param name="node" select=".."/>
  846.             </xsl:call-template>
  847.             <xsl:apply-templates select=".." mode="divnum"/>
  848.             <xsl:apply-templates/>
  849.             <xsl:text> (Non-Normative)</xsl:text>
  850.         </h2>
  851.     </xsl:template>
  852.     <xsl:template match="issue/head">
  853.         <p class="prefix">
  854.             <b>
  855.                 <xsl:apply-templates/>
  856.             </b>
  857.         </p>
  858.     </xsl:template>
  859.     <xsl:template match="scrap/head">
  860.         <xsl:text> </xsl:text>
  861.         <h5>
  862.             <xsl:call-template name="anchor">
  863.                 <xsl:with-param name="node" select=".."/>
  864.                 <xsl:with-param name="conditional" select="0"/>
  865.             </xsl:call-template>
  866.             <xsl:apply-templates/>
  867.         </h5>
  868.     </xsl:template>
  869.     <xsl:template match="vcnote/head">
  870.         <p class="prefix">
  871.             <xsl:if test="../@id">
  872.                 <a name="{../@id}" id="{../@id}"/>
  873.             </xsl:if>
  874.             <b>
  875.                 <xsl:text>Validity constraint: </xsl:text>
  876.                 <xsl:apply-templates/>
  877.             </b>
  878.         </p>
  879.     </xsl:template>
  880.     <xsl:template match="wfcnote/head">
  881.         <p class="prefix">
  882.             <xsl:if test="../@id">
  883.                 <a name="{../@id}" id="{../@id}"/>
  884.             </xsl:if>
  885.             <b>
  886.                 <xsl:text>Well-formedness constraint: </xsl:text>
  887.                 <xsl:apply-templates/>
  888.             </b>
  889.         </p>
  890.     </xsl:template>
  891.     <!-- header: metadata about the spec -->
  892.     <!-- pull out information into standard W3C layout -->
  893.     <xsl:template match="header">
  894.         <div class="head">
  895.             <xsl:if test="not(/spec/@role='editors-copy')">
  896.                 <p>
  897.                     <a href="http://www.w3.org/">
  898.                         <img src="http://www.w3.org/Icons/w3c_home" alt="W3C" height="48" width="72"/>
  899.                     </a>
  900.                 </p>
  901.             </xsl:if>
  902.             <xsl:text> </xsl:text>
  903.             <h1>
  904.                 <xsl:call-template name="anchor">
  905.                     <xsl:with-param name="node" select="title[1]"/>
  906.                     <xsl:with-param name="conditional" select="0"/>
  907.                     <xsl:with-param name="default.id" select="'title'"/>
  908.                 </xsl:call-template>
  909.                 <xsl:apply-templates select="title"/>
  910.                 <xsl:if test="version">
  911.                     <xsl:text> </xsl:text>
  912.                     <xsl:apply-templates select="version"/>
  913.                 </xsl:if>
  914.             </h1>
  915.             <xsl:if test="subtitle">
  916.                 <xsl:text> </xsl:text>
  917.                 <h2>
  918.                     <xsl:call-template name="anchor">
  919.                         <xsl:with-param name="node" select="subtitle[1]"/>
  920.                         <xsl:with-param name="conditional" select="0"/>
  921.                         <xsl:with-param name="default.id" select="'subtitle'"/>
  922.                     </xsl:call-template>
  923.                     <xsl:apply-templates select="subtitle"/>
  924.                 </h2>
  925.             </xsl:if>
  926.             <xsl:text> </xsl:text>
  927.             <h2>
  928.                 <xsl:call-template name="anchor">
  929.                     <xsl:with-param name="node" select="w3c-doctype[1]"/>
  930.                     <xsl:with-param name="conditional" select="0"/>
  931.                     <xsl:with-param name="default.id" select="'w3c-doctype'"/>
  932.                 </xsl:call-template>
  933.                 <xsl:apply-templates select="w3c-doctype"/>
  934.                 <xsl:text> </xsl:text>
  935.                 <xsl:if test="pubdate/day">
  936.                     <xsl:apply-templates select="pubdate/day"/>
  937.                     <xsl:text> </xsl:text>
  938.                 </xsl:if>
  939.                 <xsl:apply-templates select="pubdate/month"/>
  940.                 <xsl:text> </xsl:text>
  941.                 <xsl:apply-templates select="pubdate/year"/>
  942.             </h2>
  943.             <dl>
  944.                 <xsl:apply-templates select="publoc"/>
  945.                 <xsl:apply-templates select="latestloc"/>
  946.                 <xsl:apply-templates select="prevlocs"/>
  947.                 <xsl:apply-templates select="authlist"/>
  948.             </dl>
  949.             <!-- output the altlocs -->
  950.             <xsl:apply-templates select="altlocs"/>
  951.             <xsl:choose>
  952.                 <xsl:when test="copyright">
  953.                     <xsl:apply-templates select="copyright"/>
  954.                 </xsl:when>
  955.                 <xsl:otherwise>
  956.                     <p class="copyright">
  957.                         <a href="http://www.w3.org/Consortium/Legal/ipr-notice-20000612#Copyright">
  958.                             <xsl:text>Copyright</xsl:text>
  959.                         </a>
  960.                         <xsl:text> © </xsl:text>
  961.                         <xsl:apply-templates select="pubdate/year"/>
  962.                         <xsl:text> </xsl:text>
  963.                         <a href="http://www.w3.org/">
  964.                             <abbr title="World Wide Web Consortium">W3C</abbr>
  965.                         </a>
  966.                         <sup>®</sup>
  967.                         <xsl:text> (</xsl:text>
  968.                         <a href="http://www.lcs.mit.edu/">
  969.                             <abbr title="Massachusetts Institute of Technology">MIT</abbr>
  970.                         </a>
  971.                         <xsl:text>, </xsl:text>
  972.                         <a href="http://www.inria.fr/">
  973.                             <abbr lang="fr" title="Institut National de Recherche en Informatique et Automatique">INRIA</abbr>
  974.                         </a>
  975.                         <xsl:text>, </xsl:text>
  976.                         <a href="http://www.keio.ac.jp/">Keio</a>
  977.                         <xsl:text>), All Rights Reserved. W3C </xsl:text>
  978.                         <a href="http://www.w3.org/Consortium/Legal/ipr-notice-20000612#Legal_Disclaimer">liability</a>
  979.                         <xsl:text>, </xsl:text>
  980.                         <a href="http://www.w3.org/Consortium/Legal/ipr-notice-20000612#W3C_Trademarks">trademark</a>
  981.                         <xsl:text>, </xsl:text>
  982.                         <a href="http://www.w3.org/Consortium/Legal/copyright-documents-19990405">document use</a>
  983.                         <xsl:text>, and </xsl:text>
  984.                         <a href="http://www.w3.org/Consortium/Legal/copyright-software-19980720">software licensing</a>
  985.                         <xsl:text> rules apply.</xsl:text>
  986.                     </p>
  987.                 </xsl:otherwise>
  988.             </xsl:choose>
  989.         </div>
  990.         <hr/>
  991.         <xsl:apply-templates select="notice"/>
  992.         <xsl:apply-templates select="abstract"/>
  993.         <xsl:apply-templates select="status"/>
  994.     </xsl:template>
  995.     <xsl:template match="copyright">
  996.         <xsl:apply-templates/>
  997.     </xsl:template>
  998.     <xsl:template match="copyright/p">
  999.         <p class="copyright">
  1000.             <xsl:apply-templates/>
  1001.         </p>
  1002.     </xsl:template>
  1003.     <!-- inform-div1: non-normative back matter top-level division -->
  1004.     <!-- treat like div1 except add "(Non-Normative)" to title -->
  1005.     <xsl:template match="inform-div1">
  1006.         <div class="div1">
  1007.             <xsl:apply-templates/>
  1008.         </div>
  1009.     </xsl:template>
  1010.     <!-- interface: -->
  1011.     <!-- IDL stuff isn't handled yet -->
  1012.     <!-- issue: open issue before the Working Group -->
  1013.     <!-- maintain an ID for linking to it -->
  1014.     <!-- currently generates boilerplate head plus optional head child
  1015.        element; this should probably be cleaned up to only use the
  1016.        head if it's present -->
  1017.     <xsl:template match="issue">
  1018.         <div class="issue">
  1019.             <p class="prefix">
  1020.                 <xsl:if test="@id">
  1021.                     <a name="{@id}" id="{@id}"/>
  1022.                 </xsl:if>
  1023.                 <b>
  1024.                     <xsl:text>Issue (</xsl:text>
  1025.                     <xsl:value-of select="@id"/>
  1026.                     <xsl:text>):</xsl:text>
  1027.                 </b>
  1028.             </p>
  1029.             <xsl:apply-templates/>
  1030.             <xsl:if test="not(resolution)">
  1031.                 <p class="prefix">
  1032.                     <b>
  1033.                         <xsl:text>Resolution:</xsl:text>
  1034.                     </b>
  1035.                 </p>
  1036.                 <p>None recorded.</p>
  1037.             </xsl:if>
  1038.         </div>
  1039.     </xsl:template>
  1040.     <!-- item: generic list item -->
  1041.     <xsl:template match="item">
  1042.         <li>
  1043.             <xsl:apply-templates/>
  1044.         </li>
  1045.     </xsl:template>
  1046.     <!-- kw: keyword -->
  1047.     <!-- make it bold -->
  1048.     <xsl:template match="kw">
  1049.         <b>
  1050.             <xsl:apply-templates/>
  1051.         </b>
  1052.     </xsl:template>
  1053.     <!-- label: term for defintion in glossary entry -->
  1054.     <!-- already in <dl> context from glist -->
  1055.     <xsl:template match="label">
  1056.         <dt class="label">
  1057.             <xsl:call-template name="anchor">
  1058.                 <xsl:with-param name="node" select=".."/>
  1059.             </xsl:call-template>
  1060.             <xsl:call-template name="anchor"/>
  1061.             <xsl:apply-templates/>
  1062.         </dt>
  1063.     </xsl:template>
  1064.     <!-- language: -->
  1065.     <!-- langusage: -->
  1066.     <!-- identify language usage within a spec; not actually formatted -->
  1067.     <!-- latestloc: latest location for this spec -->
  1068.     <!-- called in a <dl> context from header -->
  1069.     <xsl:template match="latestloc">
  1070.         <dt>Latest version:</dt>
  1071.         <dd>
  1072.             <xsl:apply-templates/>
  1073.         </dd>
  1074.     </xsl:template>
  1075.     <!-- lhs: left-hand side of formal productions -->
  1076.     <!-- make a table row with the lhs and the corresponding other
  1077.        pieces in this crazy mixed-up content model -->
  1078.     <xsl:template match="lhs">
  1079.         <tr valign="baseline">
  1080.             <td>
  1081.                 <xsl:if test="ancestor-or-self::*/@diff and $show.diff.markup='1'">
  1082.                     <xsl:attribute name="class"><xsl:text>diff-</xsl:text><xsl:value-of select="ancestor-or-self::*/@diff"/></xsl:attribute>
  1083.                 </xsl:if>
  1084.                 <xsl:if test="../@id">
  1085.                     <a name="{../@id}" id="{../@id}"/>
  1086.                 </xsl:if>
  1087.                 <xsl:apply-templates select="ancestor::prod" mode="number"/>
  1088.                 <!--
  1089.   This could be done right here, but XT goes into deep space when the
  1090.   node to be numbered isn't the current node and level="any":
  1091.           <xsl:number count="prod" level="any" from="spec"
  1092.             format="[1]"/>
  1093.   -->
  1094.                 <xsl:text>   </xsl:text>
  1095.             </td>
  1096.             <td>
  1097.                 <xsl:if test="ancestor-or-self::*/@diff and $show.diff.markup='1'">
  1098.                     <xsl:attribute name="class"><xsl:text>diff-</xsl:text><xsl:value-of select="ancestor-or-self::*/@diff"/></xsl:attribute>
  1099.                 </xsl:if>
  1100.                 <code>
  1101.                     <xsl:apply-templates/>
  1102.                 </code>
  1103.             </td>
  1104.             <td>
  1105.                 <xsl:if test="ancestor-or-self::*/@diff and $show.diff.markup='1'">
  1106.                     <xsl:attribute name="class"><xsl:text>diff-</xsl:text><xsl:value-of select="ancestor-or-self::*/@diff"/></xsl:attribute>
  1107.                 </xsl:if>
  1108.                 <xsl:text>   ::=   </xsl:text>
  1109.             </td>
  1110.             <xsl:apply-templates select="following-sibling::*[1][name()='rhs']"/>
  1111.         </tr>
  1112.     </xsl:template>
  1113.     <!-- loc: a Web location -->
  1114.     <!-- outside the header, it's a normal cross-reference -->
  1115.     <xsl:template match="loc">
  1116.         <a href="{@href}">
  1117.             <xsl:apply-templates/>
  1118.         </a>
  1119.     </xsl:template>
  1120.     <!-- member: member of an organization -->
  1121.     <!-- appears only in orglist, which creates <ul> context -->
  1122.     <xsl:template match="member">
  1123.         <li>
  1124.             <xsl:apply-templates/>
  1125.         </li>
  1126.     </xsl:template>
  1127.     <!-- method: -->
  1128.     <!-- IDL stuff isn't handled yet -->
  1129.     <!-- module: -->
  1130.     <!-- IDL stuff isn't handled yet -->
  1131.     <!-- month: month of spec -->
  1132.     <!-- only used in pudate; called directly from header template -->
  1133.     <xsl:template match="month">
  1134.         <xsl:apply-templates/>
  1135.     </xsl:template>
  1136.     <!-- name: name of an editor or organization member -->
  1137.     <!-- only appears in author and member -->
  1138.     <!-- just output text -->
  1139.     <xsl:template match="name">
  1140.         <xsl:apply-templates/>
  1141.     </xsl:template>
  1142.     <!-- note: a note about the spec -->
  1143.     <xsl:template match="note">
  1144.         <div class="note">
  1145.             <p class="prefix">
  1146.                 <b>Note:</b>
  1147.             </p>
  1148.             <xsl:apply-templates/>
  1149.         </div>
  1150.     </xsl:template>
  1151.     <!-- notice: a front-matter advisory about the spec's status -->
  1152.     <!-- make sure people notice it -->
  1153.     <xsl:template match="notice">
  1154.         <div class="notice">
  1155.             <p class="prefix">
  1156.                 <b>NOTICE:</b>
  1157.             </p>
  1158.             <xsl:apply-templates/>
  1159.         </div>
  1160.     </xsl:template>
  1161.     <!-- nt: production non-terminal -->
  1162.     <!-- make a link to the non-terminal's definition -->
  1163.     <xsl:template match="nt">
  1164.         <a>
  1165.             <xsl:attribute name="href"><xsl:call-template name="href.target"><xsl:with-param name="target" select="key('ids', @def)"/></xsl:call-template></xsl:attribute>
  1166.             <xsl:apply-templates/>
  1167.         </a>
  1168.     </xsl:template>
  1169.     <!-- ====================================================================== -->
  1170.     <!-- OrderedList Numeration -->
  1171.     <xsl:template name="next.numeration">
  1172.         <xsl:param name="numeration" select="'default'"/>
  1173.         <xsl:choose>
  1174.             <!-- Change this list if you want to change the order of numerations -->
  1175.             <xsl:when test="$numeration = 'arabic'">loweralpha</xsl:when>
  1176.             <xsl:when test="$numeration = 'loweralpha'">lowerroman</xsl:when>
  1177.             <xsl:when test="$numeration = 'lowerroman'">upperalpha</xsl:when>
  1178.             <xsl:when test="$numeration = 'upperalpha'">upperroman</xsl:when>
  1179.             <xsl:when test="$numeration = 'upperroman'">arabic</xsl:when>
  1180.             <xsl:otherwise>arabic</xsl:otherwise>
  1181.         </xsl:choose>
  1182.     </xsl:template>
  1183.     <xsl:template name="list.numeration">
  1184.         <xsl:param name="node" select="."/>
  1185.         <xsl:choose>
  1186.             <xsl:when test="$node/ancestor::olist">
  1187.                 <xsl:call-template name="next.numeration">
  1188.                     <xsl:with-param name="numeration">
  1189.                         <xsl:call-template name="list.numeration">
  1190.                             <xsl:with-param name="node" select="$node/ancestor::olist[1]"/>
  1191.                         </xsl:call-template>
  1192.                     </xsl:with-param>
  1193.                 </xsl:call-template>
  1194.             </xsl:when>
  1195.             <xsl:otherwise>
  1196.                 <xsl:call-template name="next.numeration"/>
  1197.             </xsl:otherwise>
  1198.         </xsl:choose>
  1199.     </xsl:template>
  1200.     <!-- olist: an ordered list -->
  1201.     <xsl:template match="olist">
  1202.         <xsl:variable name="numeration">
  1203.             <xsl:call-template name="list.numeration"/>
  1204.         </xsl:variable>
  1205.         <xsl:variable name="type">
  1206.             <xsl:choose>
  1207.                 <xsl:when test="$numeration='arabic'">1</xsl:when>
  1208.                 <xsl:when test="$numeration='loweralpha'">a</xsl:when>
  1209.                 <xsl:when test="$numeration='lowerroman'">i</xsl:when>
  1210.                 <xsl:when test="$numeration='upperalpha'">A</xsl:when>
  1211.                 <xsl:when test="$numeration='upperroman'">I</xsl:when>
  1212.                 <!-- What!? This should never happen -->
  1213.                 <xsl:otherwise>
  1214.                     <xsl:message>
  1215.                         <xsl:text>Unexpected numeration: </xsl:text>
  1216.                         <xsl:value-of select="$numeration"/>
  1217.                     </xsl:message>
  1218.                     <xsl:value-of select="1"/>
  1219.                 </xsl:otherwise>
  1220.             </xsl:choose>
  1221.         </xsl:variable>
  1222.         <ol type="{$type}">
  1223.             <xsl:apply-templates/>
  1224.         </ol>
  1225.     </xsl:template>
  1226.     <!-- orglist: a list of an organization's members -->
  1227.     <xsl:template match="orglist">
  1228.         <ul>
  1229.             <xsl:apply-templates/>
  1230.         </ul>
  1231.     </xsl:template>
  1232.     <!-- p: a standard paragraph -->
  1233.     <xsl:template match="p">
  1234.         <p>
  1235.             <xsl:if test="@id">
  1236.                 <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
  1237.             </xsl:if>
  1238.             <xsl:if test="@role">
  1239.                 <xsl:attribute name="class"><xsl:value-of select="@role"/></xsl:attribute>
  1240.             </xsl:if>
  1241.             <xsl:apply-templates/>
  1242.         </p>
  1243.     </xsl:template>
  1244.     <!-- param: -->
  1245.     <!-- IDL stuff isn't handled yet -->
  1246.     <!-- parameters: -->
  1247.     <!-- IDL stuff isn't handled yet -->
  1248.     <!-- phrase: semantically meaningless markup hanger -->
  1249.     <!-- role attributes may be used to request different formatting,
  1250.        which isn't currently handled -->
  1251.     <xsl:template match="phrase">
  1252.         <xsl:apply-templates/>
  1253.     </xsl:template>
  1254.     <!-- prevlocs: previous locations for this spec -->
  1255.     <!-- called in a <dl> context from header -->
  1256.     <xsl:template match="prevlocs">
  1257.         <dt>
  1258.             <xsl:text>Previous version</xsl:text>
  1259.             <xsl:if test="count(loc) > 1">s</xsl:if>
  1260.             <xsl:text>:</xsl:text>
  1261.         </dt>
  1262.         <dd>
  1263.             <xsl:apply-templates/>
  1264.         </dd>
  1265.     </xsl:template>
  1266.     <!-- prod: a formal grammar production -->
  1267.     <!-- if not in a prodgroup, needs a <tbody> -->
  1268.     <!-- has a weird content model; makes a table but there are no
  1269.        explicit rules; many different things can start a new row -->
  1270.     <!-- process the first child in each row, and it will process the
  1271.        others -->
  1272.     <xsl:template match="prod">
  1273.         <tbody>
  1274.             <xsl:apply-templates select="lhs |
  1275.                 rhs[preceding-sibling::*[1][name()!='lhs']] |
  1276.                 com[preceding-sibling::*[1][name()!='rhs']] |
  1277.                 constraint[preceding-sibling::*[1][name()!='rhs']] |
  1278.                 vc[preceding-sibling::*[1][name()!='rhs']] |
  1279.                 wfc[preceding-sibling::*[1][name()!='rhs']]"/>
  1280.         </tbody>
  1281.     </xsl:template>
  1282.     <xsl:template match="prodgroup/prod">
  1283.         <xsl:apply-templates select="lhs |
  1284.               rhs[preceding-sibling::*[1][name()!='lhs']] |
  1285.               com[preceding-sibling::*[1][name()!='rhs']] |
  1286.               constraint[preceding-sibling::*[1][name()!='rhs']] |
  1287.               vc[preceding-sibling::*[1][name()!='rhs']] |
  1288.               wfc[preceding-sibling::*[1][name()!='rhs']]"/>
  1289.     </xsl:template>
  1290.     <!-- prodgroup: group of formal productions -->
  1291.     <!-- create one <tbody> for each group -->
  1292.     <xsl:template match="prodgroup">
  1293.         <tbody>
  1294.             <xsl:apply-templates/>
  1295.         </tbody>
  1296.     </xsl:template>
  1297.     <!-- prodrecap: reiteration of a prod -->
  1298.     <!-- process the prod in another node that will never generate a
  1299.        <tbody> or a number, plus links the lhs to the original
  1300.        production -->
  1301.     <xsl:template match="prodrecap">
  1302.         <tbody>
  1303.             <xsl:apply-templates select="key('ids', @ref)" mode="ref"/>
  1304.         </tbody>
  1305.     </xsl:template>
  1306.     <!-- proto: function prototype -->
  1307.     <!-- type and name of the function, with arguments in parens -->
  1308.     <xsl:template match="proto">
  1309.         <p>
  1310.             <em>
  1311.                 <xsl:value-of select="@return-type"/>
  1312.             </em>
  1313.             <xsl:text> </xsl:text>
  1314.             <b>
  1315.                 <xsl:value-of select="@name"/>
  1316.             </b>
  1317.             <xsl:text>(</xsl:text>
  1318.             <xsl:apply-templates/>
  1319.             <xsl:text>)</xsl:text>
  1320.         </p>
  1321.     </xsl:template>
  1322.     <!-- pubdate: date of spec -->
  1323.     <!-- called directly from header -->
  1324.     <!-- publoc: location of current version of spec -->
  1325.     <!-- called from header in <dl> context -->
  1326.     <xsl:template match="publoc">
  1327.         <dt>This version:</dt>
  1328.         <dd>
  1329.             <xsl:apply-templates/>
  1330.         </dd>
  1331.     </xsl:template>
  1332.     <xsl:template match="altlocs">
  1333.         <p>
  1334.             <xsl:text>This document is also available </xsl:text>
  1335.             <xsl:text>in these non-normative formats: </xsl:text>
  1336.             <xsl:for-each select="loc">
  1337.                 <xsl:if test="position() > 1">
  1338.                     <xsl:if test="last() > 2">
  1339.                         <xsl:text>, </xsl:text>
  1340.                     </xsl:if>
  1341.                     <xsl:if test="last() = 2">
  1342.                         <xsl:text> </xsl:text>
  1343.                     </xsl:if>
  1344.                 </xsl:if>
  1345.                 <xsl:if test="position() = last() and position() > 1">and </xsl:if>
  1346.                 <a href="{@href}">
  1347.                     <xsl:apply-templates/>
  1348.                 </a>
  1349.             </xsl:for-each>
  1350.             <xsl:text>.</xsl:text>
  1351.         </p>
  1352.     </xsl:template>
  1353.     <!-- pubstmt: statement of publication -->
  1354.     <!-- not currently output -->
  1355.     <!-- quote: a quoted string or phrase -->
  1356.     <!-- it would be nice to use HTML <q> elements, but browser support
  1357.        is abysmal -->
  1358.     <xsl:template match="quote">
  1359.         <xsl:text>"</xsl:text>
  1360.         <xsl:apply-templates/>
  1361.         <xsl:text>"</xsl:text>
  1362.     </xsl:template>
  1363.     <!-- raises: -->
  1364.     <!-- IDL stuff isn't handled yet -->
  1365.     <!-- reference: -->
  1366.     <!-- IDL stuff isn't handled yet -->
  1367.     <!-- resolution: resolution of an issue -->
  1368.     <xsl:template match="resolution">
  1369.         <p class="prefix">
  1370.             <b>
  1371.                 <xsl:if test="@role='partial'">Partial </xsl:if>
  1372.                 <xsl:text>Resolution:</xsl:text>
  1373.             </b>
  1374.         </p>
  1375.         <xsl:apply-templates/>
  1376.     </xsl:template>
  1377.     <!-- returns: -->
  1378.     <!-- IDL stuff isn't handled yet -->
  1379.     <!-- revisiondesc: description of spec revision -->
  1380.     <!-- used for internal tracking; not formatted -->
  1381.     <!-- rhs: right-hand side of a formal production -->
  1382.     <!-- make a table cell; if it's not the first after an LHS, make a
  1383.        new row, too -->
  1384.     <xsl:template match="rhs">
  1385.         <xsl:choose>
  1386.             <xsl:when test="preceding-sibling::*[1][name()='lhs']">
  1387.                 <td>
  1388.                     <xsl:if test="ancestor-or-self::*/@diff and $show.diff.markup='1'">
  1389.                         <xsl:attribute name="class"><xsl:text>diff-</xsl:text><xsl:value-of select="ancestor-or-self::*/@diff"/></xsl:attribute>
  1390.                     </xsl:if>
  1391.                     <code>
  1392.                         <xsl:apply-templates/>
  1393.                     </code>
  1394.                 </td>
  1395.                 <xsl:apply-templates select="following-sibling::*[1][name()='com' or
  1396.                                           name()='constraint' or
  1397.                                           name()='vc' or
  1398.                                           name()='wfc']"/>
  1399.             </xsl:when>
  1400.             <xsl:otherwise>
  1401.                 <tr valign="baseline">
  1402.                     <td/>
  1403.                     <td/>
  1404.                     <td/>
  1405.                     <td>
  1406.                         <xsl:if test="ancestor-or-self::*/@diff and $show.diff.markup='1'">
  1407.                             <xsl:attribute name="class"><xsl:text>diff-</xsl:text><xsl:value-of select="ancestor-or-self::*/@diff"/></xsl:attribute>
  1408.                         </xsl:if>
  1409.                         <code>
  1410.                             <xsl:apply-templates/>
  1411.                         </code>
  1412.                     </td>
  1413.                     <xsl:apply-templates select="following-sibling::*[1][name()='com' or
  1414.                                             name()='constraint' or
  1415.                                             name()='vc' or
  1416.                                             name()='wfc']"/>
  1417.                 </tr>
  1418.             </xsl:otherwise>
  1419.         </xsl:choose>
  1420.     </xsl:template>
  1421.     <!-- role: part played by a member of an organization -->
  1422.     <xsl:template match="role">
  1423.         <xsl:text> (</xsl:text>
  1424.         <i>
  1425.             <xsl:apply-templates/>
  1426.         </i>
  1427.         <xsl:text>) </xsl:text>
  1428.     </xsl:template>
  1429.     <!-- scrap: series of formal grammar productions -->
  1430.     <!-- set up a <table> and handle children -->
  1431.     <xsl:template match="scrap">
  1432.         <xsl:apply-templates select="head"/>
  1433.         <table class="scrap" summary="Scrap">
  1434.             <xsl:apply-templates select="bnf | prod | prodgroup"/>
  1435.         </table>
  1436.     </xsl:template>
  1437.     <!-- sequence: -->
  1438.     <!-- IDL stuff isn't handled yet -->
  1439.     <!-- sitem: simple list item -->
  1440.     <!-- just make one paragraph with <br>s between items -->
  1441.     <xsl:template match="sitem">
  1442.         <xsl:apply-templates/>
  1443.     </xsl:template>
  1444.     <xsl:template match="sitem[position() > 1]" priority="2">
  1445.         <br/>
  1446.         <xsl:apply-templates/>
  1447.     </xsl:template>
  1448.     <!-- slist: simple list -->
  1449.     <!-- using a <blockquote> to indent the list is very wrong, but it works -->
  1450.     <xsl:template match="slist">
  1451.         <blockquote>
  1452.             <p>
  1453.                 <xsl:apply-templates/>
  1454.             </p>
  1455.         </blockquote>
  1456.     </xsl:template>
  1457.     <!-- source: the source of an issue -->
  1458.     <xsl:template match="source">
  1459.         <p>
  1460.             <b>Source</b>
  1461.             <xsl:text>: </xsl:text>
  1462.             <xsl:apply-templates/>
  1463.         </p>
  1464.     </xsl:template>
  1465.     <!-- sourcedesc: description of spec preparation -->
  1466.     <!-- used for tracking the source, but not formatted -->
  1467.     <!-- spec: the specification itself -->
  1468.     <xsl:template match="spec">
  1469.         <html>
  1470.             <xsl:if test="header/langusage/language">
  1471.                 <xsl:attribute name="lang"><xsl:value-of select="header/langusage/language/@id"/></xsl:attribute>
  1472.             </xsl:if>
  1473.             <head>
  1474.                 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
  1475.                 <title>
  1476.                     <xsl:apply-templates select="header/title"/>
  1477.                     <xsl:if test="header/version">
  1478.                         <xsl:text> </xsl:text>
  1479.                         <xsl:apply-templates select="header/version"/>
  1480.                     </xsl:if>
  1481.                     <xsl:if test="$additional.title != ''">
  1482.                         <xsl:text> -- </xsl:text>
  1483.                         <xsl:value-of select="$additional.title"/>
  1484.                     </xsl:if>
  1485.                 </title>
  1486.                 <xsl:call-template name="css"/>
  1487.             </head>
  1488.             <body>
  1489.                 <xsl:apply-templates/>
  1490.                 <xsl:if test="//footnote[not(ancestor::table)]">
  1491.                     <hr/>
  1492.                     <div class="endnotes">
  1493.                         <xsl:text> </xsl:text>
  1494.                         <h3>
  1495.                             <xsl:call-template name="anchor">
  1496.                                 <xsl:with-param name="conditional" select="0"/>
  1497.                                 <xsl:with-param name="default.id" select="'endnotes'"/>
  1498.                             </xsl:call-template>
  1499.                             <xsl:text>End Notes</xsl:text>
  1500.                         </h3>
  1501.                         <dl>
  1502.                             <xsl:apply-templates select="//footnote[not(ancestor::table)]" mode="notes"/>
  1503.                         </dl>
  1504.                     </div>
  1505.                 </xsl:if>
  1506.             </body>
  1507.         </html>
  1508.     </xsl:template>
  1509.     <!-- specref: reference to another part of teh current specification -->
  1510.     <xsl:template match="specref">
  1511.         <xsl:variable name="target" select="key('ids', @ref)[1]"/>
  1512.         <xsl:choose>
  1513.             <xsl:when test="local-name($target)='issue'">
  1514.                 <xsl:text>[</xsl:text>
  1515.                 <a>
  1516.                     <xsl:attribute name="href"><xsl:call-template name="href.target"><xsl:with-param name="target" select="key('ids', @ref)"/></xsl:call-template></xsl:attribute>
  1517.                     <b>
  1518.                         <xsl:text>Issue </xsl:text>
  1519.                         <xsl:apply-templates select="key('ids', @ref)" mode="number"/>
  1520.                         <xsl:text>: </xsl:text>
  1521.                         <xsl:for-each select="key('ids', @ref)/head">
  1522.                             <xsl:apply-templates/>
  1523.                         </xsl:for-each>
  1524.                     </b>
  1525.                 </a>
  1526.                 <xsl:text>]</xsl:text>
  1527.             </xsl:when>
  1528.             <xsl:when test="starts-with(local-name($target), 'div')">
  1529.                 <a>
  1530.                     <xsl:attribute name="href"><xsl:call-template name="href.target"><xsl:with-param name="target" select="key('ids', @ref)"/></xsl:call-template></xsl:attribute>
  1531.                     <b>
  1532.                         <xsl:apply-templates select="key('ids', @ref)" mode="divnum"/>
  1533.                         <xsl:apply-templates select="key('ids', @ref)/head" mode="text"/>
  1534.                     </b>
  1535.                 </a>
  1536.             </xsl:when>
  1537.             <xsl:when test="starts-with(local-name($target), 'inform-div')">
  1538.                 <a>
  1539.                     <xsl:attribute name="href"><xsl:call-template name="href.target"><xsl:with-param name="target" select="key('ids', @ref)"/></xsl:call-template></xsl:attribute>
  1540.                     <b>
  1541.                         <xsl:apply-templates select="key('ids', @ref)" mode="divnum"/>
  1542.                         <xsl:apply-templates select="key('ids', @ref)/head" mode="text"/>
  1543.                     </b>
  1544.                 </a>
  1545.             </xsl:when>
  1546.             <xsl:when test="local-name($target) = 'vcnote'">
  1547.                 <b>
  1548.                     <xsl:text>[VC: </xsl:text>
  1549.                     <a>
  1550.                         <xsl:attribute name="href"><xsl:call-template name="href.target"><xsl:with-param name="target" select="key('ids', @ref)"/></xsl:call-template></xsl:attribute>
  1551.                         <xsl:apply-templates select="key('ids', @ref)/head" mode="text"/>
  1552.                     </a>
  1553.                     <xsl:text>]</xsl:text>
  1554.                 </b>
  1555.             </xsl:when>
  1556.             <xsl:when test="local-name($target) = 'prod'">
  1557.                 <b>
  1558.                     <xsl:text>[PROD: </xsl:text>
  1559.                     <a>
  1560.                         <xsl:attribute name="href"><xsl:call-template name="href.target"><xsl:with-param name="target" select="key('ids', @ref)"/></xsl:call-template></xsl:attribute>
  1561.                         <xsl:apply-templates select="$target" mode="number-simple"/>
  1562.                     </a>
  1563.                     <xsl:text>]</xsl:text>
  1564.                 </b>
  1565.             </xsl:when>
  1566.             <xsl:when test="local-name($target) = 'label'">
  1567.                 <b>
  1568.                     <xsl:text>[</xsl:text>
  1569.                     <a>
  1570.                         <xsl:attribute name="href"><xsl:call-template name="href.target"><xsl:with-param name="target" select="key('ids', @ref)"/></xsl:call-template></xsl:attribute>
  1571.                         <xsl:value-of select="$target"/>
  1572.                     </a>
  1573.                     <xsl:text>]</xsl:text>
  1574.                 </b>
  1575.             </xsl:when>
  1576.             <xsl:otherwise>
  1577.                 <xsl:message>
  1578.                     <xsl:text>Unsupported specref to </xsl:text>
  1579.                     <xsl:value-of select="local-name($target)"/>
  1580.                     <xsl:text> [</xsl:text>
  1581.                     <xsl:value-of select="@ref"/>
  1582.                     <xsl:text>] </xsl:text>
  1583.                     <xsl:text> (Contact stylesheet maintainer).</xsl:text>
  1584.                 </xsl:message>
  1585.                 <b>
  1586.                     <a>
  1587.                         <xsl:attribute name="href"><xsl:call-template name="href.target"><xsl:with-param name="target" select="key('ids', @ref)"/></xsl:call-template></xsl:attribute>
  1588.                         <xsl:text>???</xsl:text>
  1589.                     </a>
  1590.                 </b>
  1591.             </xsl:otherwise>
  1592.         </xsl:choose>
  1593.     </xsl:template>
  1594.     <!-- status: the status of the spec -->
  1595.     <xsl:template match="status">
  1596.         <div>
  1597.             <xsl:text> </xsl:text>
  1598.             <h2>
  1599.                 <xsl:call-template name="anchor">
  1600.                     <xsl:with-param name="conditional" select="0"/>
  1601.                     <xsl:with-param name="default.id" select="'status'"/>
  1602.                 </xsl:call-template>
  1603.                 <xsl:text>Status of this Document</xsl:text>
  1604.             </h2>
  1605.             <xsl:if test="/spec/@role='editors-copy'">
  1606.                 <p>
  1607.                     <strong>This document is an editors' copy that has
  1608.         no official standing.</strong>
  1609.                 </p>
  1610.             </xsl:if>
  1611.             <xsl:apply-templates/>
  1612.         </div>
  1613.     </xsl:template>
  1614.     <!-- struct: -->
  1615.     <!-- IDL stuff isn't handled yet -->
  1616.     <!-- sub: subscript -->
  1617.     <xsl:template match="sub">
  1618.         <sub>
  1619.             <xsl:apply-templates/>
  1620.         </sub>
  1621.     </xsl:template>
  1622.     <!-- subtitle: secondary title of spec -->
  1623.     <!-- handled directly within header -->
  1624.     <xsl:template match="title">
  1625.         <xsl:apply-templates/>
  1626.     </xsl:template>
  1627.     <!-- sup: superscript -->
  1628.     <xsl:template match="sup">
  1629.         <sup>
  1630.             <xsl:apply-templates/>
  1631.         </sup>
  1632.     </xsl:template>
  1633.     <!-- table: the HTML table model adopted wholesale; note however that we -->
  1634.     <!-- do this such that the XHTML stylesheet will do the right thing. -->
  1635.     <xsl:template match="caption|col|colgroup|td|tfoot|th|thead|tr|tbody">
  1636.         <xsl:element name="{local-name(.)}">
  1637.             <xsl:for-each select="@*">
  1638.                 <!-- Wait: some of these aren't HTML attributes after all... -->
  1639.                 <xsl:if test="local-name(.) != 'diff'">
  1640.                     <xsl:copy>
  1641.                         <xsl:apply-templates/>
  1642.                     </xsl:copy>
  1643.                 </xsl:if>
  1644.             </xsl:for-each>
  1645.             <xsl:apply-templates/>
  1646.         </xsl:element>
  1647.     </xsl:template>
  1648.     <!-- but table is special, to handle footnotes -->
  1649.     <xsl:template match="table">
  1650.         <table>
  1651.             <xsl:for-each select="@*">
  1652.                 <!-- Wait: some of these aren't HTML attributes after all... -->
  1653.                 <xsl:if test="local-name(.) != 'diff'">
  1654.                     <xsl:copy>
  1655.                         <xsl:apply-templates/>
  1656.                     </xsl:copy>
  1657.                 </xsl:if>
  1658.             </xsl:for-each>
  1659.             <xsl:apply-templates/>
  1660.             <xsl:if test=".//footnote">
  1661.                 <tbody>
  1662.                     <tr>
  1663.                         <td>
  1664.                             <xsl:apply-templates select=".//footnote" mode="table.notes"/>
  1665.                         </td>
  1666.                     </tr>
  1667.                 </tbody>
  1668.             </xsl:if>
  1669.         </table>
  1670.     </xsl:template>
  1671.     <!-- term: the actual mention of a term within a termdef -->
  1672.     <xsl:template match="term">
  1673.         <b>
  1674.             <xsl:apply-templates/>
  1675.         </b>
  1676.     </xsl:template>
  1677.     <!-- termdef: sentence or phrase defining a term -->
  1678.     <xsl:template match="termdef">
  1679.         <xsl:text>[</xsl:text>
  1680.         <a name="{@id}" id="{@id}" title="{@term}">
  1681.             <xsl:text>Definition</xsl:text>
  1682.         </a>
  1683.         <xsl:text>: </xsl:text>
  1684.         <xsl:apply-templates/>
  1685.         <xsl:text>]</xsl:text>
  1686.     </xsl:template>
  1687.     <!-- termref: reference to a defined term -->
  1688.     <xsl:template match="termref">
  1689.         <a title="{key('ids', @def)/@term}">
  1690.             <xsl:attribute name="href"><xsl:call-template name="href.target"><xsl:with-param name="target" select="key('ids', @def)"/></xsl:call-template></xsl:attribute>
  1691.             <xsl:apply-templates/>
  1692.         </a>
  1693.     </xsl:template>
  1694.     <!-- tfoot: see table -->
  1695.     <!-- th: see table -->
  1696.     <!-- thead: see table -->
  1697.     <!-- title: title of the specification -->
  1698.     <!-- called directly within header -->
  1699.     <!-- titleref: reference to the title of any work -->
  1700.     <!-- if a URL is given, link it -->
  1701.     <xsl:template match="titleref">
  1702.         <xsl:choose>
  1703.             <xsl:when test="@href">
  1704.                 <a href="{@href}">
  1705.                     <cite>
  1706.                         <xsl:apply-templates/>
  1707.                     </cite>
  1708.                 </a>
  1709.             </xsl:when>
  1710.             <xsl:otherwise>
  1711.                 <cite>
  1712.                     <xsl:apply-templates/>
  1713.                 </cite>
  1714.             </xsl:otherwise>
  1715.         </xsl:choose>
  1716.     </xsl:template>
  1717.     <!-- tr: see table -->
  1718.     <!-- typedef: -->
  1719.     <!-- IDL stuff isn't handled yet -->
  1720.     <!-- typename: -->
  1721.     <!-- IDL stuff isn't handled yet -->
  1722.     <!-- ulist: unordered list -->
  1723.     <xsl:template match="ulist">
  1724.         <ul>
  1725.             <xsl:apply-templates/>
  1726.         </ul>
  1727.     </xsl:template>
  1728.     <!-- union: -->
  1729.     <!-- IDL stuff isn't handled yet -->
  1730.     <!-- var: a variable -->
  1731.     <xsl:template match="var">
  1732.         <var>
  1733.             <xsl:apply-templates/>
  1734.         </var>
  1735.     </xsl:template>
  1736.     <!-- vc: validity check reference in a formal production -->
  1737.     <xsl:template match="vc">
  1738.         <xsl:choose>
  1739.             <xsl:when test="preceding-sibling::*[1][name()='rhs']">
  1740.                 <td>
  1741.                     <xsl:if test="@diff and $show.diff.markup='1'">
  1742.                         <xsl:attribute name="class"><xsl:text>diff-</xsl:text><xsl:value-of select="@diff"/></xsl:attribute>
  1743.                     </xsl:if>
  1744.                     <a>
  1745.                         <xsl:attribute name="href"><xsl:call-template name="href.target"><xsl:with-param name="target" select="key('ids', @def)"/></xsl:call-template></xsl:attribute>
  1746.                         <xsl:text>[VC: </xsl:text>
  1747.                         <xsl:apply-templates select="key('ids', @def)/head" mode="text"/>
  1748.                         <xsl:text>]</xsl:text>
  1749.                     </a>
  1750.                 </td>
  1751.             </xsl:when>
  1752.             <xsl:otherwise>
  1753.                 <tr valign="baseline">
  1754.                     <td/>
  1755.                     <td/>
  1756.                     <td/>
  1757.                     <td/>
  1758.                     <td>
  1759.                         <xsl:if test="@diff and $show.diff.markup='1'">
  1760.                             <xsl:attribute name="class"><xsl:text>diff-</xsl:text><xsl:value-of select="@diff"/></xsl:attribute>
  1761.                         </xsl:if>
  1762.                         <a>
  1763.                             <xsl:attribute name="href"><xsl:call-template name="href.target"><xsl:with-param name="target" select="key('ids', @def)"/></xsl:call-template></xsl:attribute>
  1764.                             <xsl:text>[VC: </xsl:text>
  1765.                             <xsl:apply-templates select="key('ids', @def)/head" mode="text"/>
  1766.                             <xsl:text>]</xsl:text>
  1767.                         </a>
  1768.                     </td>
  1769.                 </tr>
  1770.             </xsl:otherwise>
  1771.         </xsl:choose>
  1772.     </xsl:template>
  1773.     <!-- vcnote: validity check note after a formal production -->
  1774.     <xsl:template match="vcnote">
  1775.         <div class="constraint">
  1776.             <xsl:apply-templates/>
  1777.         </div>
  1778.     </xsl:template>
  1779.     <!-- version: version of this spec -->
  1780.     <!-- called directly from header -->
  1781.     <xsl:template match="version">
  1782.         <xsl:apply-templates/>
  1783.     </xsl:template>
  1784.     <!-- w3c-designation: canonical name for this spec -->
  1785.     <!-- not used for formatting -->
  1786.     <!-- w3c-doctype: type of document the specification is -->
  1787.     <!-- used by header template to select CSS stylesheet for output
  1788.        HTML -->
  1789.     <xsl:template match="w3c-doctype">
  1790.         <xsl:apply-templates/>
  1791.     </xsl:template>
  1792.     <!-- wfc: well-formedness check reference in a formal production -->
  1793.     <xsl:template match="wfc">
  1794.         <xsl:choose>
  1795.             <xsl:when test="preceding-sibling::*[1][name()='rhs']">
  1796.                 <td>
  1797.                     <xsl:if test="@diff and $show.diff.markup='1'">
  1798.                         <xsl:attribute name="class"><xsl:text>diff-</xsl:text><xsl:value-of select="@diff"/></xsl:attribute>
  1799.                     </xsl:if>
  1800.                     <a>
  1801.                         <xsl:attribute name="href"><xsl:call-template name="href.target"><xsl:with-param name="target" select="key('ids', @def)"/></xsl:call-template></xsl:attribute>
  1802.                         <xsl:text>[WFC: </xsl:text>
  1803.                         <xsl:apply-templates select="key('ids', @def)/head" mode="text"/>
  1804.                         <xsl:text>]</xsl:text>
  1805.                     </a>
  1806.                 </td>
  1807.             </xsl:when>
  1808.             <xsl:otherwise>
  1809.                 <tr valign="baseline">
  1810.                     <td/>
  1811.                     <td/>
  1812.                     <td/>
  1813.                     <td/>
  1814.                     <td>
  1815.                         <xsl:if test="@diff and $show.diff.markup='1'">
  1816.                             <xsl:attribute name="class"><xsl:text>diff-</xsl:text><xsl:value-of select="@diff"/></xsl:attribute>
  1817.                         </xsl:if>
  1818.                         <a>
  1819.                             <xsl:attribute name="href"><xsl:call-template name="href.target"><xsl:with-param name="target" select="key('ids', @def)"/></xsl:call-template></xsl:attribute>
  1820.                             <xsl:text>[WFC: </xsl:text>
  1821.                             <xsl:apply-templates select="key('ids', @def)/head" mode="text"/>
  1822.                             <xsl:text>]</xsl:text>
  1823.                         </a>
  1824.                     </td>
  1825.                 </tr>
  1826.             </xsl:otherwise>
  1827.         </xsl:choose>
  1828.     </xsl:template>
  1829.     <!-- wfcnote: well-formedness check note after formal production -->
  1830.     <xsl:template match="wfcnote">
  1831.         <div class="constraint">
  1832.             <xsl:apply-templates/>
  1833.         </div>
  1834.     </xsl:template>
  1835.     <!-- xnt: external non-terminal -->
  1836.     <!-- xspecref: external specification reference -->
  1837.     <!-- xtermref: external term reference -->
  1838.     <!-- just link to URI provided -->
  1839.     <xsl:template match="xnt | xspecref | xtermref">
  1840.         <a href="{@href}">
  1841.             <xsl:apply-templates/>
  1842.         </a>
  1843.     </xsl:template>
  1844.     <!-- year: year of spec -->
  1845.     <!-- only used in pudate; called directly from header template -->
  1846.     <xsl:template match="year">
  1847.         <xsl:apply-templates/>
  1848.     </xsl:template>
  1849.     <!-- Silly HTML elements used for pasting stuff in; shouldn't ever
  1850.        show up in a spec, but they're easy to handle and you just
  1851.        never know. -->
  1852.     <xsl:template match="a|div|em|h1|h2|h3|h4|h5|h6|li|ol|pre|ul">
  1853.         <xsl:element name="{local-name(.)}">
  1854.             <xsl:for-each select="@*">
  1855.                 <xsl:copy>
  1856.                     <xsl:apply-templates/>
  1857.                 </xsl:copy>
  1858.             </xsl:for-each>
  1859.             <xsl:apply-templates/>
  1860.         </xsl:element>
  1861.     </xsl:template>
  1862.     <!-- legacy XML spec stuff -->
  1863.     <xsl:template match="htable">
  1864.         <table summary="HTML Table">
  1865.             <xsl:for-each select="@*">
  1866.                 <xsl:copy>
  1867.                     <xsl:apply-templates/>
  1868.                 </xsl:copy>
  1869.             </xsl:for-each>
  1870.             <xsl:apply-templates/>
  1871.         </table>
  1872.     </xsl:template>
  1873.     <xsl:template match="htbody">
  1874.         <tbody>
  1875.             <xsl:for-each select="@*">
  1876.                 <xsl:copy>
  1877.                     <xsl:apply-templates/>
  1878.                 </xsl:copy>
  1879.             </xsl:for-each>
  1880.             <xsl:apply-templates/>
  1881.         </tbody>
  1882.     </xsl:template>
  1883.     <xsl:template match="key-term">
  1884.         <b>
  1885.             <xsl:apply-templates/>
  1886.         </b>
  1887.     </xsl:template>
  1888.     <xsl:template match="statusp">
  1889.         <p>
  1890.             <xsl:apply-templates/>
  1891.         </p>
  1892.     </xsl:template>
  1893.     <!-- legacy DocBook stuff -->
  1894.     <xsl:template match="itemizedlist">
  1895.         <ul>
  1896.             <xsl:apply-templates/>
  1897.         </ul>
  1898.     </xsl:template>
  1899.     <xsl:template match="listitem">
  1900.         <li>
  1901.             <xsl:apply-templates/>
  1902.         </li>
  1903.     </xsl:template>
  1904.     <xsl:template match="orderedlist">
  1905.         <ol>
  1906.             <xsl:apply-templates/>
  1907.         </ol>
  1908.     </xsl:template>
  1909.     <xsl:template match="para">
  1910.         <p>
  1911.             <xsl:apply-templates/>
  1912.         </p>
  1913.     </xsl:template>
  1914.     <!-- mode: divnum -->
  1915.     <xsl:template mode="divnum" match="div1">
  1916.         <xsl:number format="1 "/>
  1917.     </xsl:template>
  1918.     <xsl:template mode="divnum" match="back/div1 | inform-div1">
  1919.         <xsl:number count="div1 | inform-div1" format="A "/>
  1920.     </xsl:template>
  1921.     <xsl:template mode="divnum" match="front/div1 | front//div2 | front//div3 | front//div4 | front//div5"/>
  1922.     <xsl:template mode="divnum" match="div2">
  1923.         <xsl:number level="multiple" count="div1 | div2" format="1.1 "/>
  1924.     </xsl:template>
  1925.     <xsl:template mode="divnum" match="back//div2">
  1926.         <xsl:number level="multiple" count="div1 | div2 | inform-div1" format="A.1 "/>
  1927.     </xsl:template>
  1928.     <xsl:template mode="divnum" match="div3">
  1929.         <xsl:number level="multiple" count="div1 | div2 | div3" format="1.1.1 "/>
  1930.     </xsl:template>
  1931.     <xsl:template mode="divnum" match="back//div3">
  1932.         <xsl:number level="multiple" count="div1 | div2 | div3 | inform-div1" format="A.1.1 "/>
  1933.     </xsl:template>
  1934.     <xsl:template mode="divnum" match="div4">
  1935.         <xsl:number level="multiple" count="div1 | div2 | div3 | div4" format="1.1.1.1 "/>
  1936.     </xsl:template>
  1937.     <xsl:template mode="divnum" match="back//div4">
  1938.         <xsl:number level="multiple" count="div1 | div2 | div3 | div4 | inform-div1" format="A.1.1.1 "/>
  1939.     </xsl:template>
  1940.     <xsl:template mode="divnum" match="div5">
  1941.         <xsl:number level="multiple" count="div1 | div2 | div3 | div4 | div5" format="1.1.1.1.1 "/>
  1942.     </xsl:template>
  1943.     <xsl:template mode="divnum" match="back//div5">
  1944.         <xsl:number level="multiple" count="div1 | div2 | div3 | div4 | div5 | inform-div1" format="A.1.1.1.1 "/>
  1945.     </xsl:template>
  1946.     <!-- mode: notes -->
  1947.     <xsl:template mode="notes" match="footnote">
  1948.         <xsl:variable name="this-note-id">
  1949.             <xsl:choose>
  1950.                 <xsl:when test="@id">
  1951.                     <xsl:value-of select="@id"/>
  1952.                 </xsl:when>
  1953.                 <xsl:otherwise>
  1954.                     <xsl:value-of select="generate-id(.)"/>
  1955.                 </xsl:otherwise>
  1956.             </xsl:choose>
  1957.         </xsl:variable>
  1958.         <dt>
  1959.             <xsl:text>[</xsl:text>
  1960.             <a name="{$this-note-id}" id="{$this-note-id}" href="#FN-ANCH-{$this-note-id}">
  1961.                 <xsl:apply-templates select="." mode="number-simple"/>
  1962.             </a>
  1963.             <xsl:text>]</xsl:text>
  1964.         </dt>
  1965.         <dd>
  1966.             <xsl:apply-templates/>
  1967.         </dd>
  1968.     </xsl:template>
  1969.     <!-- mode: table.notes -->
  1970.     <xsl:template match="footnote" mode="table.notes">
  1971.         <xsl:apply-templates mode="table.notes"/>
  1972.     </xsl:template>
  1973.     <xsl:template match="footnote/p[1]" mode="table.notes">
  1974.         <xsl:variable name="this-note-id">
  1975.             <xsl:choose>
  1976.                 <xsl:when test="../@id">
  1977.                     <xsl:value-of select="../@id"/>
  1978.                 </xsl:when>
  1979.                 <xsl:otherwise>
  1980.                     <xsl:value-of select="generate-id(parent::*)"/>
  1981.                 </xsl:otherwise>
  1982.             </xsl:choose>
  1983.         </xsl:variable>
  1984.         <p class="table.footnote">
  1985.             <sup>
  1986.                 <a name="{$this-note-id}" id="{$this-note-id}" href="#FN-ANCH-{$this-note-id}">
  1987.                     <xsl:apply-templates select="parent::footnote" mode="number-simple"/>
  1988.                     <xsl:text>.</xsl:text>
  1989.                 </a>
  1990.             </sup>
  1991.             <xsl:text> </xsl:text>
  1992.             <xsl:apply-templates/>
  1993.         </p>
  1994.     </xsl:template>
  1995.     <!-- mode: number -->
  1996.     <xsl:template mode="number" match="prod">
  1997.         <xsl:text>[</xsl:text>
  1998.         <xsl:apply-templates select="." mode="number-simple"/>
  1999.         <xsl:text>]</xsl:text>
  2000.     </xsl:template>
  2001.     <xsl:template mode="number" match="issue">
  2002.         <xsl:number level="single" format="1"/>
  2003.     </xsl:template>
  2004.     <xsl:template mode="number" match="prod[@diff='add']">
  2005.         <xsl:text>[</xsl:text>
  2006.         <xsl:apply-templates select="preceding::prod[not(@diff='add')][1]" mode="number-simple"/>
  2007.         <!--
  2008.   Once again, this could be done right here, but XT won't hear of it.
  2009.     <xsl:number level="any" count="prod[not(@diff='add')]"/>
  2010.   -->
  2011.         <xsl:number level="any" count="prod[@diff='add']" from="prod[not(@diff='add')]" format="a"/>
  2012.         <xsl:text>]</xsl:text>
  2013.     </xsl:template>
  2014.     <!-- mode: number-simple -->
  2015.     <xsl:template mode="number-simple" match="prod">
  2016.         <xsl:number level="any" count="prod[not(@diff='add')]"/>
  2017.     </xsl:template>
  2018.     <xsl:template mode="number-simple" match="footnote">
  2019.         <xsl:number level="any" format="1"/>
  2020.     </xsl:template>
  2021.     <!-- mode: ref -->
  2022.     <xsl:template match="lhs" mode="ref">
  2023.         <tr valign="baseline">
  2024.             <td/>
  2025.             <td>
  2026.                 <xsl:if test="ancestor-or-self::*/@diff and $show.diff.markup='1'">
  2027.                     <xsl:attribute name="class"><xsl:text>diff-</xsl:text><xsl:value-of select="ancestor-or-self::*/@diff"/></xsl:attribute>
  2028.                 </xsl:if>
  2029.                 <xsl:if test="../@id">
  2030.                     <a name="{../@id}" id="{../@id}"/>
  2031.                 </xsl:if>
  2032.                 <code>
  2033.                     <xsl:apply-templates/>
  2034.                 </code>
  2035.             </td>
  2036.             <td>
  2037.                 <xsl:if test="ancestor-or-self::*/@diff and $show.diff.markup='1'">
  2038.                     <xsl:attribute name="class"><xsl:text>diff-</xsl:text><xsl:value-of select="ancestor-or-self::*/@diff"/></xsl:attribute>
  2039.                 </xsl:if>
  2040.                 <xsl:text>   ::=   </xsl:text>
  2041.             </td>
  2042.             <xsl:apply-templates select="following-sibling::*[1][name()='rhs']"/>
  2043.         </tr>
  2044.     </xsl:template>
  2045.     <xsl:template mode="ref" match="prod">
  2046.         <xsl:apply-templates select="lhs" mode="ref"/>
  2047.         <xsl:apply-templates select="rhs[preceding-sibling::*[1][name()!='lhs']] |
  2048.               com[preceding-sibling::*[1][name()!='rhs']] |
  2049.               constraint[preceding-sibling::*[1][name()!='rhs']] |
  2050.               vc[preceding-sibling::*[1][name()!='rhs']] |
  2051.               wfc[preceding-sibling::*[1][name()!='rhs']]"/>
  2052.     </xsl:template>
  2053.     <!-- mode: text -->
  2054.     <!-- most stuff processes just as text here, but some things should
  2055.        be hidden -->
  2056.     <xsl:template mode="text" match="ednote | footnote"/>
  2057.     <!-- mode: toc -->
  2058.     <xsl:template mode="toc" match="div1">
  2059.         <xsl:apply-templates select="." mode="divnum"/>
  2060.         <a>
  2061.             <xsl:attribute name="href"><xsl:call-template name="href.target"><xsl:with-param name="target" select="."/></xsl:call-template></xsl:attribute>
  2062.             <xsl:apply-templates select="head" mode="text"/>
  2063.         </a>
  2064.         <br/>
  2065.         <xsl:if test="$toc.level > 1">
  2066.             <xsl:apply-templates select="div2" mode="toc"/>
  2067.         </xsl:if>
  2068.     </xsl:template>
  2069.     <xsl:template mode="toc" match="div2">
  2070.         <xsl:text>    </xsl:text>
  2071.         <xsl:apply-templates select="." mode="divnum"/>
  2072.         <a>
  2073.             <xsl:attribute name="href"><xsl:call-template name="href.target"><xsl:with-param name="target" select="."/></xsl:call-template></xsl:attribute>
  2074.             <xsl:apply-templates select="head" mode="text"/>
  2075.         </a>
  2076.         <br/>
  2077.         <xsl:if test="$toc.level > 2">
  2078.             <xsl:apply-templates select="div3" mode="toc"/>
  2079.         </xsl:if>
  2080.     </xsl:template>
  2081.     <xsl:template mode="toc" match="div3">
  2082.         <xsl:text>        </xsl:text>
  2083.         <xsl:apply-templates select="." mode="divnum"/>
  2084.         <a>
  2085.             <xsl:attribute name="href"><xsl:call-template name="href.target"><xsl:with-param name="target" select="."/></xsl:call-template></xsl:attribute>
  2086.             <xsl:apply-templates select="head" mode="text"/>
  2087.         </a>
  2088.         <br/>
  2089.         <xsl:if test="$toc.level > 3">
  2090.             <xsl:apply-templates select="div4" mode="toc"/>
  2091.         </xsl:if>
  2092.     </xsl:template>
  2093.     <xsl:template mode="toc" match="div4">
  2094.         <xsl:text>            </xsl:text>
  2095.         <xsl:apply-templates select="." mode="divnum"/>
  2096.         <a>
  2097.             <xsl:attribute name="href"><xsl:call-template name="href.target"><xsl:with-param name="target" select="."/></xsl:call-template></xsl:attribute>
  2098.             <xsl:apply-templates select="head" mode="text"/>
  2099.         </a>
  2100.         <br/>
  2101.         <xsl:if test="$toc.level > 4">
  2102.             <xsl:apply-templates select="div5" mode="toc"/>
  2103.         </xsl:if>
  2104.     </xsl:template>
  2105.     <xsl:template mode="toc" match="div5">
  2106.         <xsl:text>                </xsl:text>
  2107.         <xsl:apply-templates select="." mode="divnum"/>
  2108.         <a>
  2109.             <xsl:attribute name="href"><xsl:call-template name="href.target"><xsl:with-param name="target" select="."/></xsl:call-template></xsl:attribute>
  2110.             <xsl:apply-templates select="head" mode="text"/>
  2111.         </a>
  2112.         <br/>
  2113.     </xsl:template>
  2114.     <xsl:template mode="toc" match="inform-div1">
  2115.         <xsl:apply-templates select="." mode="divnum"/>
  2116.         <a>
  2117.             <xsl:attribute name="href"><xsl:call-template name="href.target"><xsl:with-param name="target" select="."/></xsl:call-template></xsl:attribute>
  2118.             <xsl:apply-templates select="head" mode="text"/>
  2119.         </a>
  2120.         <xsl:text> (Non-Normative)</xsl:text>
  2121.         <br/>
  2122.         <xsl:if test="$toc.level > 2">
  2123.             <xsl:apply-templates select="div2" mode="toc"/>
  2124.         </xsl:if>
  2125.     </xsl:template>
  2126.     <xsl:template name="css">
  2127.         <style type="text/css">
  2128.             <xsl:text>
  2129. code           { font-family: monospace; }
  2130.  
  2131. div.constraint,
  2132. div.issue,
  2133. div.note,
  2134. div.notice     { margin-left: 2em; }
  2135.  
  2136. li p           { margin-top: 0.3em;
  2137.                  margin-bottom: 0.3em; }
  2138. </xsl:text>
  2139.             <xsl:if test="$tabular.examples = 0">
  2140.                 <xsl:text>
  2141. div.exampleInner pre { margin-left: 1em;
  2142.                        margin-top: 0em; margin-bottom: 0em}
  2143. div.exampleOuter {border: 4px double gray;
  2144.                   margin: 0em; padding: 0em}
  2145. div.exampleInner { background-color: #d5dee3;
  2146.                    border-top-width: 4px;
  2147.                    border-top-style: double;
  2148.                    border-top-color: #d3d3d3;
  2149.                    border-bottom-width: 4px;
  2150.                    border-bottom-style: double;
  2151.                    border-bottom-color: #d3d3d3;
  2152.                    padding: 4px; margin: 0em }
  2153. div.exampleWrapper { margin: 4px }
  2154. div.exampleHeader { font-weight: bold;
  2155.                     margin: 4px}
  2156. </xsl:text>
  2157.             </xsl:if>
  2158.             <xsl:value-of select="$additional.css"/>
  2159.         </style>
  2160.         <link rel="stylesheet" type="text/css">
  2161.             <xsl:attribute name="href"><xsl:text>http://www.w3.org/StyleSheets/TR/</xsl:text><xsl:choose><xsl:when test="/spec/@role='editors-copy'">base</xsl:when><xsl:otherwise><xsl:choose><xsl:when test="/spec/@w3c-doctype='wd'">W3C-WD</xsl:when><xsl:when test="/spec/@w3c-doctype='rec'">W3C-REC</xsl:when><xsl:when test="/spec/@w3c-doctype='pr'">W3C-PR</xsl:when><xsl:when test="/spec/@w3c-doctype='cr'">W3C-CR</xsl:when><xsl:when test="/spec/@w3c-doctype='note'">W3C-NOTE</xsl:when><xsl:otherwise>base</xsl:otherwise></xsl:choose></xsl:otherwise></xsl:choose><xsl:text>.css</xsl:text></xsl:attribute>
  2162.         </link>
  2163.     </xsl:template>
  2164.     <xsl:template name="href.target">
  2165.         <xsl:param name="target" select="."/>
  2166.         <xsl:text>#</xsl:text>
  2167.         <xsl:choose>
  2168.             <xsl:when test="$target/@id">
  2169.                 <xsl:value-of select="$target/@id"/>
  2170.             </xsl:when>
  2171.             <xsl:otherwise>
  2172.                 <xsl:value-of select="generate-id($target)"/>
  2173.             </xsl:otherwise>
  2174.         </xsl:choose>
  2175.     </xsl:template>
  2176.     <!-- ================================================================= -->
  2177.     <xsl:template name="object.id">
  2178.         <xsl:param name="node" select="."/>
  2179.         <xsl:param name="default.id" select="''"/>
  2180.         <xsl:choose>
  2181.             <!-- can't use the default ID if it's used somewhere else in the document! -->
  2182.             <xsl:when test="$default.id != '' and not(key('ids', $default.id))">
  2183.                 <xsl:value-of select="$default.id"/>
  2184.             </xsl:when>
  2185.             <xsl:when test="$node/@id">
  2186.                 <xsl:value-of select="$node/@id"/>
  2187.             </xsl:when>
  2188.             <xsl:otherwise>
  2189.                 <xsl:value-of select="generate-id($node)"/>
  2190.             </xsl:otherwise>
  2191.         </xsl:choose>
  2192.     </xsl:template>
  2193.     <xsl:template name="anchor">
  2194.         <xsl:param name="node" select="."/>
  2195.         <xsl:param name="conditional" select="1"/>
  2196.         <xsl:param name="default.id" select="''"/>
  2197.         <xsl:variable name="id">
  2198.             <xsl:call-template name="object.id">
  2199.                 <xsl:with-param name="node" select="$node"/>
  2200.                 <xsl:with-param name="default.id" select="$default.id"/>
  2201.             </xsl:call-template>
  2202.         </xsl:variable>
  2203.         <xsl:if test="$conditional = 0 or $node/@id">
  2204.             <a name="{$id}" id="{$id}"/>
  2205.         </xsl:if>
  2206.     </xsl:template>
  2207.     <!-- ================================================================= -->
  2208. </xsl:transform>
  2209.