Annotation of html5/pubnotes/specgen.xsl, revision 1.23

1.1       mike        1: <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
                      2:                 xmlns:h='http://www.w3.org/1999/xhtml'
                      3:                 xmlns='http://www.w3.org/1999/xhtml'
1.3       mike        4:                 exclude-result-prefixes='h'
1.1       mike        5:                 version='1.0' id='xslt'>
                      6: 
1.23    ! mike        7:   <xsl:output method='html' encoding='UTF-8'
        !             8:               doctype-public='-//W3C//DTD HTML 4.01//EN'
        !             9:               media-type='text/html; charset=UTF-8'
1.10      mike       10:               indent="yes"
                     11:               />
1.1       mike       12: 
1.18      mike       13:   <xsl:variable name='sectionsID'>this_sections</xsl:variable>
1.6       mike       14:   <xsl:variable name='appendicesID'>appendices</xsl:variable>
                     15: 
1.1       mike       16:   <xsl:variable name='id' select='/*/h:head/h:meta[@name="revision"]/@content'/>
                     17:   <xsl:variable name='rev' select='substring-before(substring-after(substring-after($id, " "), " "), " ")'/>
1.10      mike       18:   <xsl:variable name='toc-marker' select='//h:*[@id = "toc"][1]'/>
                     19:   <xsl:variable name='info' select="/*/h:body/h:*[@id = 'info']"/>
                     20:   <xsl:variable name="maturity" select="$info/h:*[@id = 'maturity']"/>
                     21:   <xsl:variable name="source" select="$info/h:*[@id = 'versions']/h:*[@id = 'source']"/>
                     22:   <xsl:variable name="this" select="$info/h:*[@id = 'versions']/h:*[@id = 'this']"/>
                     23:   <xsl:variable name="latest" select="$info/h:*[@id = 'versions']/h:*[@id = 'latest']"/>
                     24:   <xsl:variable name="previous-nodeset" select="$info/h:*[@id = 'versions']/h:*[contains(@class,'previous')]"/>
                     25:   <xsl:variable name="person-nodeset" select='$info/h:*[@id="editors"]/h:*[@ class="person"]'/>
                     26:   <xsl:variable name="wginfo-nodeset" select="$info/h:*[@id = 'wginfo']"/>
1.1       mike       27: 
                     28:   <xsl:template match='/'>
1.3       mike       29:     <xsl:if test='$maturity = "ED"'>
1.1       mike       30:       <xsl:comment> * </xsl:comment>
1.3       mike       31:       <xsl:comment> * Note: This file was generated from source at <xsl:value-of select="$source"/><xsl:text> </xsl:text></xsl:comment>
                     32:       <xsl:comment> * Run “make” to regenerate it. </xsl:comment>
1.1       mike       33:       <xsl:comment> * </xsl:comment>
                     34:     </xsl:if>
                     35:     <xsl:apply-templates select='/*'/>
                     36:   </xsl:template>
                     37: 
                     38:   <xsl:template match='h:*'>
                     39:     <xsl:element name="{name()}" namespace="{namespace-uri()}">
                     40:       <xsl:copy-of select='@*[namespace-uri()="" or namespace-uri="http://www.w3.org/XML/1998/namespace"]'/>
                     41:       <xsl:apply-templates select='node()'/>
                     42:     </xsl:element>
                     43:   </xsl:template>
                     44: 
                     45:   <xsl:template match='h:head'>
                     46:     <head>
                     47:       <xsl:copy-of select='@*[namespace-uri()="" or namespace-uri="http://www.w3.org/XML/1998/namespace"]'/>
                     48:       <xsl:apply-templates select='node()'/>
1.3       mike       49:       <xsl:text>  </xsl:text>
1.1       mike       50:       <xsl:choose>
1.3       mike       51:         <xsl:when test="$maturity = 'ED'">
1.1       mike       52:           <link rel='stylesheet' href='http://www.w3.org/StyleSheets/TR/W3C-ED' type='text/css'/>
                     53:         </xsl:when>
1.3       mike       54:         <xsl:when test='
                     55:           $maturity="WD"
                     56:           or $maturity="FPWD"
                     57:           or $maturity="LCWD"
                     58:           or $maturity="FPWDLC"
                     59:           '>
1.1       mike       60:           <link rel='stylesheet' href='http://www.w3.org/StyleSheets/TR/W3C-WD' type='text/css'/>
                     61:         </xsl:when>
                     62:         <xsl:otherwise>
1.3       mike       63:           <link rel='stylesheet' href='http://www.w3.org/StyleSheets/TR/W3C-{$maturity}' type='text/css'/>
1.1       mike       64:         </xsl:otherwise>
                     65:       </xsl:choose>
1.3       mike       66:       <xsl:text>&#10;  </xsl:text>
1.1       mike       67:     </head>
                     68:   </xsl:template>
                     69: 
1.22      mike       70:   <!-- * suppress meta@charset -->
                     71:   <xsl:template match="h:meta[@charset]"/>
1.3       mike       72:   <!-- * suppress duplication of ED CSS link -->
                     73:   <xsl:template match="h:head/h:link[@href = 'http://www.w3.org/StyleSheets/TR/W3C-ED']"/>
1.9       mike       74:   <!-- * remove source CSS link -->
                     75:   <xsl:template match="h:head/h:link[@href = 'src.css']"/>
                     76:   <!-- * remove info stuff -->
1.10      mike       77:   <xsl:template match="h:*[@id = 'info']"/>
1.9       mike       78:   <!-- * remove source admonition -->
1.4       mike       79:   <xsl:template match="*[@id = 'source-admonition']" priority="10"/>
1.1       mike       80: 
                     81:   <xsl:template name='monthName'>
                     82:     <xsl:param name='n' select='1'/>
                     83:     <xsl:param name='s' select='"January February March April May June July August September October November December "'/>
                     84:     <xsl:choose>
                     85:       <xsl:when test='string(number($n))="NaN"'>@@</xsl:when>
                     86:       <xsl:when test='$n = 1'>
                     87:         <xsl:value-of select='substring-before($s, " ")'/>
                     88:       </xsl:when>
                     89:       <xsl:otherwise>
                     90:         <xsl:call-template name='monthName'>
                     91:           <xsl:with-param name='n' select='$n - 1'/>
                     92:           <xsl:with-param name='s' select='substring-after($s, " ")'/>
                     93:         </xsl:call-template>
                     94:       </xsl:otherwise>
                     95:     </xsl:choose>
                     96:   </xsl:template>
                     97: 
1.21      mike       98:   <xsl:template match="h:body">
                     99:     <body>
                    100:       <xsl:copy-of select='@*[namespace-uri()="" or namespace-uri="http://www.w3.org/XML/1998/namespace"]'/>
                    101:       <xsl:call-template name="top"/>
                    102:       <xsl:apply-templates/>
                    103:     </body>
                    104:   </xsl:template>
                    105: 
1.5       mike      106:   <xsl:template name='top'>
1.1       mike      107:     <div class='head'>
                    108:       <div><a href="http://www.w3.org/"><img src="http://www.w3.org/Icons/w3c_home" width="72" height="48" alt="W3C"></img></a></div>
                    109:       <h1><xsl:value-of select='/*/h:head/h:title'/></h1>
                    110:       <h2>
                    111:         W3C
                    112:         <xsl:choose>
1.3       mike      113:           <xsl:when test='
                    114:             $maturity="WD"
                    115:             or $maturity="FPWD"
                    116:             or $maturity="LCWD"
                    117:             or $maturity="FPWDLC"
                    118:             '>Working Draft</xsl:when>
                    119:           <xsl:when test='$maturity="CR"'>Candidate Recommendation</xsl:when>
                    120:           <xsl:when test='$maturity="PR"'>Proposed Recommendation</xsl:when>
                    121:           <xsl:when test='$maturity="PER"'>Proposed Edited Recommendation</xsl:when>
                    122:           <xsl:when test='$maturity="REC"'>Recommendation</xsl:when>
                    123:           <xsl:when test='$maturity="WG-NOTE"'>Working Group Note</xsl:when>
1.1       mike      124:           <xsl:otherwise>Editor’s Draft</xsl:otherwise>
                    125:         </xsl:choose>
                    126:         <xsl:text> </xsl:text>
                    127:         <em>
                    128:           <xsl:call-template name='date'/>
                    129:         </em>
                    130:       </h2>
                    131: 
                    132:       <dl>
                    133:         <xsl:choose>
1.3       mike      134:           <xsl:when test='$source and $maturity="ED"'>
1.1       mike      135:             <dt>Latest Editor’s Draft:</dt>
                    136:             <dd>
1.3       mike      137:               <a id='latestED' href='{$source}'><xsl:value-of select='$source'/></a>
1.1       mike      138:               <script type='text/ecmascript'>
                    139:                 var id = "&#x24;Id$";
                    140:                 var a = document.getElementById('cvsVersionLink');
                    141:                 var xs = id.match(/ ([0-9]\.[0-9.]+) /);
                    142:                 if (xs) {
                    143:                   var rev = xs[1];
1.3       mike      144:                   a.href = "<xsl:value-of select='$source'/>?rev=" + rev + String.fromCharCode(38) + "content-type=text/html; charset=utf-8";
1.1       mike      145:                   a.firstChild.data = a.href;
                    146:                 }
                    147:               </script>
                    148:             </dd>
                    149:             <dt>Latest Published Version:</dt>
1.3       mike      150:             <xsl:if test='not($latest = "")'>
                    151:               <dd><a href='{$latest}'><xsl:value-of select='$latest'/></a></dd>
1.1       mike      152:             </xsl:if>
                    153:           </xsl:when>
                    154:           <xsl:otherwise>
                    155:             <dt>This Version:</dt>
                    156:             <dd>
1.3       mike      157:               <a href='{$this}'><xsl:value-of select='$this'/></a>
1.1       mike      158:             </dd>
                    159:             <dt>Latest Version:</dt>
1.3       mike      160:             <xsl:if test='not($latest = "")'>
                    161:               <dd><a href='{$latest}'><xsl:value-of select='$latest'/></a></dd>
1.1       mike      162:             </xsl:if>
                    163:           </xsl:otherwise>
                    164:         </xsl:choose>
1.7       mike      165:         <xsl:if test='$previous-nodeset
                    166:           and not($previous-nodeset = "")'>
                    167:           <dt>Previous Version<xsl:if test='count($previous-nodeset) > 1'>s</xsl:if>:</dt>
                    168:           <xsl:for-each select='$previous-nodeset'>
1.3       mike      169:             <dd><a href='{.}'><xsl:value-of select='.'/></a></dd>
                    170:           </xsl:for-each>
1.1       mike      171:         </xsl:if>
1.4       mike      172:         <dt>Editor<xsl:if test='count($person-nodeset) &gt; 1'>s</xsl:if>:</dt>
                    173:         <xsl:for-each select='$person-nodeset'>
1.1       mike      174:           <dd>
                    175:             <xsl:choose>
1.7       mike      176:               <xsl:when test='h:*[contains(@class,"homepage")]'>
                    177:                 <a href='{h:*[contains(@class,"homepage")]}'><xsl:value-of select='h:span[@class = "name"]'/></a>
1.1       mike      178:               </xsl:when>
                    179:               <xsl:otherwise>
1.3       mike      180:                 <xsl:value-of select='h:span[@class = "name"]'/>
1.1       mike      181:               </xsl:otherwise>
                    182:             </xsl:choose>
1.3       mike      183:             <xsl:if test='h:span[@class = "affiliation"]'>
1.1       mike      184:               <xsl:text>, </xsl:text>
1.3       mike      185:               <xsl:value-of select='h:span[@class = "affiliation"]'/>
1.1       mike      186:             </xsl:if>
1.7       mike      187:             <xsl:if test='h:*[contains(@class,"email")]'>
1.1       mike      188:               <xsl:text> &lt;</xsl:text>
1.8       mike      189:               <a href='mailto:{h:*[contains(@class,"email")]}'><xsl:value-of select='h:*[contains(@class,"email")]'/></a>
1.1       mike      190:               <xsl:text>&gt;</xsl:text>
                    191:             </xsl:if>
                    192:           </dd>
                    193:         </xsl:for-each>
                    194:       </dl>
1.3       mike      195:       <p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a><xsl:text disable-output-escaping='yes'> &amp;copy; </xsl:text><xsl:value-of select='concat(substring($this, string-length($this) - 8, 4), " ")'/><a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup><xsl:text disable-output-escaping='yes'>&amp;reg;</xsl:text></sup> (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>, <a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.</p>
1.1       mike      196:     </div>
                    197:     <hr/>
                    198:   </xsl:template>
                    199: 
                    200:   <xsl:template name='date'>
                    201:     <xsl:variable name='date'>
                    202:       <xsl:choose>
1.3       mike      203:         <xsl:when test='$maturity="ED"'>
1.1       mike      204:           <xsl:value-of select='translate(substring-before(substring-after(substring-after(substring-after($id, " "), " "), " "), " "), "/", "")'/>
                    205:         </xsl:when>
                    206:         <xsl:otherwise>
1.3       mike      207:           <xsl:value-of select='substring($this, string-length($this) - 8, 8)'/>
1.1       mike      208:         </xsl:otherwise>
                    209:       </xsl:choose>
                    210:     </xsl:variable>
                    211:     <xsl:value-of select='number(substring($date, 7))'/>
                    212:     <xsl:text> </xsl:text>
                    213:     <xsl:call-template name='monthName'>
                    214:       <xsl:with-param name='n' select='number(substring($date, 5, 2))'/>
                    215:     </xsl:call-template>
                    216:     <xsl:text> </xsl:text>
                    217:     <xsl:value-of select='substring($date, 1, 4)'/>
                    218:   </xsl:template>
                    219: 
                    220:   <xsl:template name='maturity'>
                    221:     <xsl:choose>
1.3       mike      222:       <xsl:when test='$maturity="FPWD"'>First Public Working Draft</xsl:when>
                    223:       <xsl:when test='$maturity="LCWD"'>Last Call Working Draft</xsl:when>
                    224:       <xsl:when test='$maturity="FPWDLC"'>First Public Working Draft and Last Call Working Draft</xsl:when>
                    225:       <xsl:when test='$maturity="WD"'>Working Draft</xsl:when>
                    226:       <xsl:when test='$maturity="CR"'>Candidate Recommendation</xsl:when>
                    227:       <xsl:when test='$maturity="PR"'>Proposed Recommendation</xsl:when>
                    228:       <xsl:when test='$maturity="PER"'>Proposed Edited Recommendation</xsl:when>
                    229:       <xsl:when test='$maturity="REC"'>Recommendation</xsl:when>
                    230:       <xsl:when test='$maturity="WG-NOTE"'>Working Group Note</xsl:when>
1.1       mike      231:       <xsl:otherwise>Editor’s Draft</xsl:otherwise>
                    232:     </xsl:choose>
                    233:   </xsl:template>
                    234: 
                    235:   <xsl:template name='maturity-short'>
                    236:     <xsl:choose>
1.3       mike      237:       <xsl:when test='$maturity="FPWD"'>Working Draft</xsl:when>
                    238:       <xsl:when test='$maturity="LCWD"'>Working Draft</xsl:when>
                    239:       <xsl:when test='$maturity="FPWDLC"'>Working Draft</xsl:when>
                    240:       <xsl:when test='$maturity="WD"'>Working Draft</xsl:when>
                    241:       <xsl:when test='$maturity="CR"'>Candidate Recommendation</xsl:when>
                    242:       <xsl:when test='$maturity="PR"'>Proposed Recommendation</xsl:when>
                    243:       <xsl:when test='$maturity="PER"'>Proposed Edited Recommendation</xsl:when>
                    244:       <xsl:when test='$maturity="REC"'>Recommendation</xsl:when>
                    245:       <xsl:when test='$maturity="WG-NOTE"'>Working Group Note</xsl:when>
1.1       mike      246:       <xsl:otherwise>Editor’s Draft</xsl:otherwise>
                    247:     </xsl:choose>
                    248:   </xsl:template>
                    249: 
1.10      mike      250:   <xsl:template match="h:*[@id = 'abstract']">
                    251:     <div id="abstract">
                    252:       <xsl:apply-templates/>
                    253:       <xsl:call-template name="revision-note"/>
                    254:     </div>
1.5       mike      255:   </xsl:template>
                    256: 
1.20      mike      257:   <xsl:template match="h:*[@id = 'summary']">
                    258:     <div id="summary" class="section">
                    259:       <xsl:apply-templates
                    260:         select="document('summary.html')//h:div[child::*[@id='webarch']]"/>
                    261:     </div>
                    262:   </xsl:template>
                    263: 
                    264:   <xsl:template match="h:div[child::*[@id='webarch']]">
                    265:     <xsl:apply-templates/>
                    266:   </xsl:template>
                    267: 
                    268:   <xsl:template match="h:h3[@id = 'webarch']">
                    269:     <h2>Summary: Changes impacting Web architecture <a
                    270:         href="#summary">#</a>
                    271:       <xsl:text> </xsl:text><a href="#summary-toc">T</a></h2>
                    272:   </xsl:template>
                    273: 
                    274:   <xsl:template match="h:div[child::*[@id='webarch']]/h:p[1]">
                    275:     <p>This section provides a high-level summary of changes
                    276:       introduced by new areas or features of the HTML 5
                    277:       specification that are believed to impact the Web
                    278:       architecture. For more detailed descriptions of the changes,
                    279:       see the sections in this document that follow this one.
                    280:       (Note: The source for this summary is maintained in the <a
                    281:         href="http://www.w3.org/TR/html5-diff/" >HTML 5
                    282:         differences from HTML 4</a> document; the summary was
                    283:       copied from that document into this one.)</p>
                    284:   </xsl:template>
                    285: 
1.5       mike      286:   <xsl:template name='revision-note'>
1.10      mike      287:       <xsl:if test='$maturity="ED"'>
                    288:         <div class='ednote'>
                    289:           <h4 class='ednoteHeader'>Editorial note</h4>
                    290:           <p>This is revision <xsl:value-of select='$id'/>.</p>
                    291:         </div>
                    292:       </xsl:if>
1.5       mike      293:   </xsl:template>
                    294: 
1.10      mike      295:   <xsl:template match="h:*[@id = 'status']">
                    296:     <div>
                    297:       <xsl:copy-of select='@*[namespace-uri()="" or namespace-uri="http://www.w3.org/XML/1998/namespace"]'/>
                    298:       <xsl:apply-templates select='node()'/>
                    299:       <xsl:call-template name="sotd"/>
                    300:     </div>
1.5       mike      301:   </xsl:template>
                    302: 
                    303:   <xsl:template name='sotd'>
1.7       mike      304:     <xsl:variable name='ipp' select='$wginfo-nodeset/*[@id = "ipp"]'/>
                    305:     <xsl:variable name='comments-address' select='$wginfo-nodeset/*[@id = "comments-address"]'/>
                    306:     <xsl:variable name='comments-archive' select='$wginfo-nodeset/*[@id = "comments-archive"]'/>
1.1       mike      307:     <xsl:variable name="wg">
1.7       mike      308:       <a href="{$wginfo-nodeset/*[@id = 'wg']}">
1.1       mike      309:         <xsl:choose>
1.7       mike      310:           <xsl:when test="$wginfo-nodeset/*[@id = 'wg'] = 'http://www.w3.org/html/wg'"
1.1       mike      311:             >HTML Working Group</xsl:when>
                    312:           <xsl:otherwise>[undefined working group</xsl:otherwise>
                    313:         </xsl:choose>
                    314:       </a>
                    315:     </xsl:variable>
                    316:     <xsl:variable name="activity">
1.7       mike      317:       <a href="{$wginfo-nodeset/*[@id = 'activity']}">
1.1       mike      318:         <xsl:choose>
1.7       mike      319:           <xsl:when test="$wginfo-nodeset/*[@id = 'activity'] = 'http://www.w3.org/MarkUp/Activity.html'"
1.1       mike      320:             >HTML Activity</xsl:when>
                    321:           <xsl:otherwise>[undefined activity]</xsl:otherwise>
                    322:         </xsl:choose>
                    323:       </a>
                    324:     </xsl:variable>
                    325:     <xsl:variable name="domain">
1.7       mike      326:       <a href="{$wginfo-nodeset/*[@id = 'domain']}">
1.1       mike      327:         <xsl:choose>
1.7       mike      328:           <xsl:when test="$wginfo-nodeset/*[@id = 'domain'] = 'http://www.w3.org/Interaction/'"
1.1       mike      329:             >Interaction Domain</xsl:when>
                    330:           <xsl:otherwise>[undefined domain]</xsl:otherwise>
                    331:         </xsl:choose>
                    332:       </a>
                    333:     </xsl:variable>
                    334:     <xsl:variable name="source">
1.3       mike      335:       <a href="{$source}">W3C source repository</a>
1.1       mike      336:     </xsl:variable>
                    337:     <p>
                    338:       <em>
                    339:         This section describes the status of this document at the time of
                    340:         its publication.  Other documents may supersede this document. A list
                    341:         of current W3C publications and the latest revision of this technical
                    342:         report can be found in the <a href="http://www.w3.org/TR/">W3C technical
                    343:           reports index</a> at http://www.w3.org/TR/.
                    344:       </em>
                    345:     </p>
                    346:     <p>
1.3       mike      347:       <xsl:if test='$maturity!="REC" and $maturity!="WG-NOTE"'>
1.1       mike      348:         This document is the <xsl:call-template name='date'/><xsl:text> </xsl:text>
                    349:         <b><xsl:call-template name='maturity'/></b> of 
                    350:         <cite><xsl:value-of select='/*/h:head/h:title'/></cite>.
                    351:       </xsl:if>
                    352:       Please send comments about this document to
1.8       mike      353:       <a href='mailto:{$comments-address}'><xsl:value-of select='$comments-address'/></a>
1.5       mike      354:       (<a href='{$comments-archive}'>archived</a>).
1.1       mike      355:     </p>
                    356:     <p>
                    357:       This document was produced by the <xsl:copy-of select="$wg"/>,
                    358:       part of the <xsl:copy-of select="$activity"/>
                    359:       in the W3C <xsl:copy-of select="$domain"/>.
                    360:       You can find the source for the current version of this document in the
                    361:       <xsl:copy-of select="$source"/>.
                    362:     </p>
                    363:     <p>
                    364:       <xsl:choose>
1.3       mike      365:         <xsl:when test='$maturity="REC"'>
1.1       mike      366:           This document has been reviewed by W3C Members, by software developers,
                    367:           and by other W3C groups and interested parties, and is endorsed by the
                    368:           Director as a W3C Recommendation. It is a stable document and may be
                    369:           used as reference material or cited from another document. W3C’s role
                    370:           in making the Recommendation is to draw attention to the specification
                    371:           and to promote its widespread deployment. This enhances the
                    372:           functionality and interoperability of the Web.
                    373:         </xsl:when>
                    374:         <xsl:otherwise>
                    375:           Publication as a <xsl:call-template name='maturity-short'/> does not imply endorsement by the
                    376:           W3C Membership.  This is a draft document and may be updated, replaced
                    377:           or obsoleted by other documents at any time. It is inappropriate to cite
                    378:           this document as other than work in progress.
                    379:         </xsl:otherwise>
                    380:       </xsl:choose>
                    381:     </p>
                    382:     <p>
                    383:       This document was produced by a group operating under the
                    384:       <a href='http://www.w3.org/Consortium/Patent-Policy-20040205/'>5 February
                    385:         2004 W3C Patent Policy</a>. W3C maintains a
                    386:       <a href='{$ipp}'>public list of
                    387:         any patent disclosures</a> made in connection with the deliverables of
                    388:       the group; that page also includes instructions for disclosing a patent.
                    389:       An individual who has actual knowledge of a patent which the individual
                    390:       believes contains
                    391:       <a href='http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential'>Essential
                    392:         Claim(s)</a> must disclose the information in accordance with
                    393:       <a href='http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure'>section
                    394:         6 of the W3C Patent Policy</a>.
                    395:     </p>
                    396:   </xsl:template>
                    397: 
1.10      mike      398:   <xsl:template match="h:*[@id = 'toc']">
1.12      mike      399:     <div id='toc'>
                    400:       <xsl:copy-of select='@*[namespace-uri()="" or namespace-uri="http://www.w3.org/XML/1998/namespace"]'/>
                    401:       <xsl:apply-templates select='node()'/>
1.10      mike      402:       <xsl:call-template name="toc"/>
                    403:     </div>
1.5       mike      404:   </xsl:template>
1.1       mike      405: 
1.5       mike      406:   <xsl:template name='toc'>
1.10      mike      407:     <xsl:for-each select='//*[@id=$sectionsID]'>
                    408:       <xsl:call-template name='toc1'/>
                    409:     </xsl:for-each>
                    410:     <xsl:for-each select='//*[@id=$appendicesID]'>
                    411:       <xsl:call-template name='toc1'>
                    412:         <xsl:with-param name='alpha' select='true()'/>
                    413:       </xsl:call-template>
                    414:     </xsl:for-each>
1.1       mike      415:   </xsl:template>
                    416: 
                    417:   <xsl:template match='processing-instruction("sref")'>
                    418:     <xsl:variable name='id' select='string(.)'/>
1.10      mike      419:     <xsl:variable name='s' select='//*[@id=$id]/self::h:section'/>
1.1       mike      420:     <xsl:choose>
                    421:       <xsl:when test='$s'>
                    422:         <xsl:call-template name='section-number'>
                    423:           <xsl:with-param name='section' select='$s'/>
                    424:         </xsl:call-template>
                    425:       </xsl:when>
                    426:       <xsl:otherwise>@@</xsl:otherwise>
                    427:     </xsl:choose>
                    428:   </xsl:template>
                    429: 
                    430:   <xsl:template match='processing-instruction("sdir")'>
                    431:     <xsl:variable name='id' select='string(.)'/>
                    432:     <xsl:choose>
1.10      mike      433:       <xsl:when test='preceding::h:*[@id=$id]'>above</xsl:when>
                    434:       <xsl:when test='following::h:*[@id=$id]'>below</xsl:when>
1.1       mike      435:       <xsl:otherwise>@@</xsl:otherwise>
                    436:     </xsl:choose>
                    437:   </xsl:template>
                    438: 
                    439:   <xsl:template match='processing-instruction()|comment()'/>
                    440: 
                    441:   <xsl:template name='toc1'>
1.16      mike      442:     <!-- * <xsl:param name='prefix'/> -->
                    443:     <!-- * <xsl:param name='alpha'/> -->
1.1       mike      444: 
1.10      mike      445:     <xsl:variable name='subsections' select='h:section'/>
1.1       mike      446:     <xsl:if test='$subsections'>
                    447:       <ul>
1.10      mike      448:         <xsl:for-each select='h:section'>
1.16      mike      449:           <!-- * <xsl:variable name='number'> -->
                    450:             <!-- * <xsl:value-of select='$prefix'/> -->
                    451:             <!-- * <xsl:if test='$prefix'>.</xsl:if> -->
                    452:             <!-- * <xsl:choose> -->
                    453:               <!-- * <xsl:when test='$alpha'><xsl:number value='position()' format='A'/></xsl:when> -->
                    454:               <!-- * <xsl:otherwise><xsl:value-of select='position()'/></xsl:otherwise> -->
                    455:             <!-- * </xsl:choose> -->
                    456:           <!-- * </xsl:variable> -->
1.1       mike      457:           <xsl:variable name='frag'>
                    458:             <xsl:choose>
                    459:               <xsl:when test='@id'><xsl:value-of select='@id'/></xsl:when>
                    460:               <xsl:otherwise><xsl:value-of select='generate-id(.)'/></xsl:otherwise>
                    461:             </xsl:choose>
                    462:           </xsl:variable>
1.19      mike      463:           <li id='{$frag}-toc'>
1.1       mike      464:             <a href='#{$frag}'>
1.16      mike      465:               <!-- * <xsl:value-of select='$number'/> -->
                    466:               <!-- * <xsl:text>. </xsl:text> -->
1.1       mike      467:               <xsl:value-of select='h:h2|h:h3|h:h4|h:h5|h:h6'/>
                    468:             </a>
                    469:             <xsl:call-template name='toc1'>
1.16      mike      470:               <!-- * <xsl:with-param name='prefix' select='$number'/> -->
1.1       mike      471:             </xsl:call-template>
                    472:           </li>
                    473:         </xsl:for-each>
                    474:       </ul>
                    475:     </xsl:if>
                    476:   </xsl:template>
                    477: 
                    478:   <xsl:template name='section-number'>
1.16      mike      479:     <xsl:param name='section'/>
                    480:     <xsl:param name='sections' select="//*[@id = $sectionsID]"/>
                    481:     <xsl:param name='appendices' select="//*[@id = $appendicesID]"/>
                    482:     <xsl:choose>
                    483:       <xsl:when test='$section/ancestor::* = $sections'>
                    484:         <xsl:for-each select='$section/ancestor-or-self::h:section'>
                    485:           <xsl:value-of select='count(preceding-sibling::h:section) + 1'/>
                    486:           <xsl:if test='position() != last()'>
                    487:             <xsl:text>.</xsl:text>
                    488:           </xsl:if>
                    489:         </xsl:for-each>
                    490:       </xsl:when>
                    491:       <xsl:when test='$section/ancestor::* = $appendices'>
                    492:         <xsl:for-each select='$section/ancestor-or-self::h:section'>
                    493:           <xsl:choose>
                    494:             <xsl:when test='position()=1'>
                    495:               <xsl:number value='count(preceding-sibling::h:section) + 1' format='A'/>
                    496:             </xsl:when>
                    497:             <xsl:otherwise>
                    498:               <xsl:value-of select='count(preceding-sibling::h:section) + 1'/>
                    499:             </xsl:otherwise>
                    500:           </xsl:choose>
                    501:           <xsl:if test='position() != last()'>
                    502:             <xsl:text>.</xsl:text>
                    503:           </xsl:if>
                    504:         </xsl:for-each>
                    505:       </xsl:when>
                    506:     </xsl:choose>
1.1       mike      507:   </xsl:template>
                    508: 
1.20      mike      509:   <xsl:template match='h:h2[not(../@id = "abstract")
                    510:     and not(../@id="status")
                    511:     and not(../@id="toc")
                    512:     ]'
                    513:     >
1.19      mike      514:     <xsl:variable name="myid">
                    515:       <xsl:value-of select="../@id"/>
                    516:     </xsl:variable>
1.1       mike      517:     <xsl:element name="{name()}" namespace="{namespace-uri()}">
                    518:       <xsl:copy-of select='@*[namespace-uri()="" or namespace-uri="http://www.w3.org/XML/1998/namespace"]'/>
1.14      mike      519:       <!-- * <xsl:if test='$toc-marker'> -->
                    520:         <!-- * <xsl:variable name='num'> -->
                    521:           <!-- * <xsl:call-template name='section-number'> -->
                    522:             <!-- * <xsl:with-param name='section' select='..'/> -->
                    523:           <!-- * </xsl:call-template> -->
                    524:         <!-- * </xsl:variable> -->
                    525:         <!-- * <xsl:if test='$num != ""'> -->
                    526:           <!-- * <xsl:value-of select='$num'/> -->
                    527:           <!-- * <xsl:text>. </xsl:text> -->
                    528:         <!-- * </xsl:if> -->
                    529:       <!-- * </xsl:if> -->
1.1       mike      530:       <xsl:apply-templates select='node()'/>
1.19      mike      531:       <xsl:text> </xsl:text>
                    532:       <a class="hash" href="#{$myid}">#</a>
                    533:       <xsl:text> </xsl:text>
                    534:       <a class="toc-bak" href="#{$myid}-toc">T</a>
1.1       mike      535:     </xsl:element>
1.20      mike      536:     <xsl:if test="not($myid = 'fpwd')">
1.19      mike      537:     <p class="spec-link">View “<a href="http://www.w3.org/TR/html5/#{$myid}"
                    538:         ><xsl:apply-templates select='node()'/></a>” in the
                    539:         specification</p>
1.20      mike      540:     </xsl:if>
1.1       mike      541:   </xsl:template>
                    542: 
1.10      mike      543:   <xsl:template match='h:*[@class="ednote"]'>
1.1       mike      544:     <div>
                    545:       <xsl:copy-of select='@*[namespace-uri()="" or namespace-uri="http://www.w3.org/XML/1998/namespace"]'/>
                    546:       <div class='ednoteHeader'>Editorial note</div>
                    547:       <xsl:apply-templates select='node()'/>
                    548:     </div>
                    549:   </xsl:template>
                    550: 
1.10      mike      551:   <xsl:template match='h:*[@class="example"]'>
1.1       mike      552:     <div>
                    553:       <xsl:copy-of select='@*[namespace-uri()="" or namespace-uri="http://www.w3.org/XML/1998/namespace"]'/>
                    554:       <div class='exampleHeader'>Example</div>
                    555:       <xsl:apply-templates select='node()'/>
                    556:     </div>
                    557:   </xsl:template>
                    558: 
1.10      mike      559:   <xsl:template match='h:*[@class="note"]'>
1.1       mike      560:     <div>
                    561:       <xsl:copy-of select='@*[namespace-uri()="" or namespace-uri="http://www.w3.org/XML/1998/namespace"]'/>
                    562:       <div class='noteHeader'>Note</div>
                    563:       <xsl:apply-templates select='node()'/>
                    564:     </div>
                    565:   </xsl:template>
                    566: 
1.10      mike      567:   <xsl:template match='h:section'>
                    568:     <div>
                    569:       <xsl:copy-of select='@*[namespace-uri()="" or namespace-uri="http://www.w3.org/XML/1998/namespace"]'/>
1.17      mike      570:       <xsl:attribute name="class">section</xsl:attribute>
1.10      mike      571:       <xsl:apply-templates select='node()'/>
                    572:     </div>
                    573:   </xsl:template>
                    574: 
1.1       mike      575:   <xsl:template match='*'/>
                    576: </xsl:stylesheet>

Webmaster