W3C home > Mailing lists > Public > public-html-commits@w3.org > May 2009

html5/markup/tools specgen.xsl,1.30,1.31 toc.xsl,1.2,1.3

From: Michael Smith via cvs-syncmail <cvsmail@w3.org>
Date: Sun, 03 May 2009 09:26:43 +0000
To: public-html-commits@w3.org
Message-Id: <E1M0Xy7-0005Jb-No@lionel-hutz.w3.org>
Update of /sources/public/html5/markup/tools
In directory hutz:/tmp/cvs-serv20361/tools

Modified Files:
	specgen.xsl toc.xsl 
Log Message:
h:tml; added unexpanded TOC


Index: specgen.xsl
===================================================================
RCS file: /sources/public/html5/markup/tools/specgen.xsl,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- specgen.xsl	3 May 2009 04:20:35 -0000	1.30
+++ specgen.xsl	3 May 2009 09:26:41 -0000	1.31
@@ -446,12 +446,7 @@
       </xsl:when>
     </xsl:choose>
   </xsl:template>
-  <xsl:template match='h:h2[
-    not(../@id = "abstract")
-    and not(../@id="status")
-    and not(../@id="toc")
-    ]'
-    >
+  <xsl:template match='h:h2'>
     <xsl:variable name="myid">
       <xsl:value-of select="../@id"/>
     </xsl:variable>
@@ -484,7 +479,11 @@
       </xsl:if>
       <xsl:text> </xsl:text>
       <a class="hash" href="#{$myid}">#</a>
-      <xsl:if test='not(parent::h:*[contains(@class,"no-toc")])'>
+      <xsl:if test='not(../@id = "abstract")
+        and not(../@id="status")
+        and not(../@id="unexpanded-toc")
+        and not(../@id="toc")
+        and not(parent::h:*[contains(@class,"no-toc")])'>
         <xsl:text> </xsl:text>
         <xsl:choose>
           <xsl:when test="not($chunk=0)">
@@ -598,10 +597,24 @@
   </xsl:template>
   <xsl:template match="*[@class='toc']">
     <div class="toc">
+      <xsl:copy-of select='@*[namespace-uri()="" or namespace-uri="http://www.w3.org/XML/1998/namespace"]'/>
       <xsl:text>&#10;</xsl:text>
-      <xsl:for-each select="..">
-        <xsl:call-template name="toc1"/>
-      </xsl:for-each>
+      <xsl:apply-templates select='node()'/>
+      <xsl:choose>
+        <xsl:when test="@id='unexpanded-toc'">
+          <xsl:call-template name="toc">
+            <xsl:with-param name="unexpanded" select="1"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:when test="@id='toc'">
+          <xsl:call-template name="toc"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:for-each select="..">
+            <xsl:call-template name="toc1"/>
+          </xsl:for-each>
+        </xsl:otherwise>
+      </xsl:choose>
     </div>
   </xsl:template>
 </xsl:stylesheet>

Index: toc.xsl
===================================================================
RCS file: /sources/public/html5/markup/tools/toc.xsl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- toc.xsl	3 May 2009 04:20:35 -0000	1.2
+++ toc.xsl	3 May 2009 09:26:41 -0000	1.3
@@ -2,20 +2,16 @@
                 xmlns:h='http://www.w3.org/1999/xhtml'
                 xmlns='http://www.w3.org/1999/xhtml'
                 version='1.0' id='xslt'>
-  <xsl:template match="h:*[@id = 'toc']">
-    <xsl:text>&#10;</xsl:text>
-    <div id='toc' class='toc'>
-      <xsl:copy-of select='@*[namespace-uri()="" or namespace-uri="http://www.w3.org/XML/1998/namespace"]'/>
-      <xsl:apply-templates select='node()'/>
-      <xsl:call-template name="toc"/>
-    </div>
-  </xsl:template>
   <xsl:template name='toc'>
+    <xsl:param name="unexpanded" select="0"/>
     <xsl:for-each select='//*[@id=$sectionsID]'>
-      <xsl:call-template name='toc1'/>
+      <xsl:call-template name='toc1'>
+        <xsl:with-param name="unexpanded" select="$unexpanded"/>
+      </xsl:call-template>
     </xsl:for-each>
     <xsl:for-each select='//*[@id=$appendicesID]'>
       <xsl:call-template name='toc1'>
+        <xsl:with-param name="unexpanded" select="$unexpanded"/>
         <xsl:with-param name='alpha' select='true()'/>
       </xsl:call-template>
     </xsl:for-each>
@@ -23,6 +19,7 @@
   <xsl:template name='toc1'>
     <xsl:param name='prefix'/>
     <xsl:param name='alpha'/>
+    <xsl:param name="unexpanded" select="0"/>
     <xsl:variable name='subsections' select='h:section[not(contains(@class,"no-toc"))]'/>
     <xsl:if test='$subsections'>
       <ul>
@@ -61,7 +58,12 @@
               </xsl:otherwise>
             </xsl:choose>
           </xsl:variable>
-          <li id='{$frag}-toc'>
+          <li>
+            <xsl:if test="$unexpanded=0">
+              <xsl:attribute name="id">
+                <xsl:value-of select="concat($frag,'-toc')"/>
+              </xsl:attribute>
+            </xsl:if>
             <a href='{$filename}#{$frag}'>
               <xsl:if test="not(contains(@class,'no-number'))">
                 <xsl:value-of select='$number'/>
@@ -75,9 +77,12 @@
               <span class="obsolete">(obsolete)</span>
             </xsl:if>
             <xsl:text>&#10;</xsl:text>
-            <xsl:call-template name='toc1'>
-              <xsl:with-param name='prefix' select='$number'/>
-            </xsl:call-template>
+            <xsl:if test="$unexpanded=0">
+              <xsl:call-template name='toc1'>
+                <xsl:with-param name='prefix' select='$number'/>
+                <xsl:with-param name='unexpanded' select='$unexpanded'/>
+              </xsl:call-template>
+            </xsl:if>
           </li>
           <xsl:text>&#10;</xsl:text>
         </xsl:for-each>
Received on Sunday, 3 May 2009 09:26:52 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 3 May 2009 09:27:00 GMT