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

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

Webmaster