html5/markup/tools specgen.xsl,1.26,1.27

Update of /sources/public/html5/markup/tools
In directory hutz:/tmp/cvs-serv11573/tools

Modified Files:
	specgen.xsl 
Log Message:
make links on TOC point to correct files


Index: specgen.xsl
===================================================================
RCS file: /sources/public/html5/markup/tools/specgen.xsl,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- specgen.xsl	1 May 2009 07:01:22 -0000	1.26
+++ specgen.xsl	1 May 2009 11:08:00 -0000	1.27
@@ -13,6 +13,7 @@
 
   <xsl:include href="chunker.xsl"/>
   <xsl:param name="chunk" select="0"/>
+  <xsl:param name="TOC-file"/>
 
   <xsl:key name="id" match="*" use="@id"/>
   <xsl:key name="chunk-for-id" match="*[@id]" use="ancestor::h:section[child::h:h2[@class='element-head']]
@@ -478,8 +479,40 @@
               <xsl:otherwise><xsl:value-of select='generate-id(.)'/></xsl:otherwise>
             </xsl:choose>
           </xsl:variable>
+          <xsl:variable name='section-id'>
+            <xsl:choose>
+              <xsl:when test='$chunk=0'/>
+              <xsl:otherwise>
+                <xsl:value-of select="
+                  key('id',$frag)[ancestor-or-self::h:section[@id='elements']]/@id
+                  |key('id',$frag)/ancestor-or-self::h:section[count(ancestor::h:section)=0 and not(@id='elements')]/@id
+                  "/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:variable>
+          <xsl:variable name='filename'>
+            <xsl:choose>
+              <xsl:when test='$chunk=0'/>
+              <xsl:when test="$section-id=''">
+                <xsl:message>
+                  <xsl:text>UNDEFINED: </xsl:text>
+                  <xsl:value-of select="$frag"/>
+                  <xsl:text> in </xsl:text>
+                  <xsl:value-of select="ancestor-or-self::h:section[child::h:h2[@class='element-head']]/@id
+                    |ancestor::h:section[(count(ancestor::h:section)=0 and not(@id='elements'))]/@id"/>
+                  <xsl:text>.html</xsl:text>
+                </xsl:message>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:message>
+                  <xsl:value-of select="concat($section-id,'.html')"/>
+                </xsl:message>
+                <xsl:value-of select="concat($section-id,'.html')"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:variable>
           <li id='{$frag}-toc'>
-            <a href='#{$frag}'>
+            <a href='{$filename}#{$frag}'>
               <xsl:if test="not(contains(@class,'no-number'))">
                 <xsl:value-of select='$number'/>
                 <xsl:text>. </xsl:text>
@@ -574,7 +607,7 @@
       <a class="hash" href="#{$myid}">#</a>
       <xsl:if test='not(parent::h:*[contains(@class,"no-toc")])'>
         <xsl:text> </xsl:text>
-        <a class="toc-bak" href="#{$myid}-toc">T</a>
+        <a class="toc-bak" href="{$TOC-file}#{$myid}-toc">T</a>
       </xsl:if>
     </xsl:element>
   </xsl:template>

Received on Friday, 1 May 2009 11:08:11 UTC