html5/markup/tools specgen.xsl,1.81,1.82

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

Modified Files:
	specgen.xsl 
Log Message:
build tweak (consolidate index items)


Index: specgen.xsl
===================================================================
RCS file: /sources/public/html5/markup/tools/specgen.xsl,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -d -r1.81 -r1.82
--- specgen.xsl	6 Aug 2010 12:47:52 -0000	1.81
+++ specgen.xsl	7 Aug 2010 15:06:26 -0000	1.82
@@ -169,7 +169,7 @@
             </p>
             <xsl:text>&#10;</xsl:text>
             <xsl:if test="count(key('refs',@id)) > 0">
-              <ul>
+              <xsl:variable name="index-items">
                 <xsl:text>&#10;</xsl:text>
                 <xsl:for-each select="key('refs',@id)">
                   <xsl:variable name="href" select="@href"/>
@@ -208,19 +208,7 @@
                       </xsl:otherwise>
                     </xsl:choose>
                     <xsl:choose>
-                      <xsl:when test="$subsection/@id = $section/@id">
-                        <xsl:if test="count($section//h:a[@href = $href]) > 1">
-                          <xsl:for-each select="$section//h:a[@href = $href]">
-                            <xsl:if test="generate-id(.) = $id and not(position() = 1)">
-                              <span class="index-counter">
-                                <xsl:text> [</xsl:text>
-                                <xsl:value-of select="position()"/>
-                                <xsl:text>]</xsl:text>
-                              </span>
-                            </xsl:if>
-                          </xsl:for-each>
-                        </xsl:if>
-                      </xsl:when>
+                      <xsl:when test="$subsection/@id = $section/@id"/>
                       <xsl:otherwise>
                         <xsl:text>: </xsl:text>
                         <xsl:choose>
@@ -240,7 +228,7 @@
                                 <xsl:text> attribute</xsl:text>
                               </xsl:when>
                               <xsl:otherwise>
-                                <cite class="index">
+                                <cite class="index-dfn">
                                   <xsl:value-of select="normalize-space($subsection)"/>
                                 </cite>
                               </xsl:otherwise>
@@ -250,30 +238,6 @@
                             <xsl:text>@@FIXME@@</xsl:text>
                           </xsl:otherwise>
                         </xsl:choose>
-                        <xsl:if test="count($subsection//h:a[@href = $href]) > 1">
-                          <xsl:for-each select="$subsection//h:a[@href = $href]">
-                            <xsl:if test="generate-id(.) = $id and not(position() = 1)">
-                              <span class="index-counter">
-                                <xsl:text> [</xsl:text>
-                                <xsl:value-of select="position()"/>
-                                <xsl:text>]</xsl:text>
-                              </span>
-                            </xsl:if>
-                          </xsl:for-each>
-                        </xsl:if>
-                        <xsl:if test="count($subsection/following-sibling::*//h:a[@href = $href]) > 1">
-                          <xsl:for-each select="
-                            $subsection/following-sibling::*//h:a[@href = $href]
-                            ">
-                            <xsl:if test="generate-id(.) = $id and not(position() = 1)">
-                              <span class="index-counter">
-                                <xsl:text> [</xsl:text>
-                                <xsl:value-of select="position()"/>
-                                <xsl:text>]</xsl:text>
-                              </span>
-                            </xsl:if>
-                          </xsl:for-each>
-                        </xsl:if>
                       </xsl:otherwise>
                     </xsl:choose>
                   </xsl:variable>
@@ -287,6 +251,28 @@
                   </xsl:choose>
                 </xsl:for-each>
                 <xsl:text>&#10;</xsl:text>
+              </xsl:variable>
+              <ul>
+                <xsl:for-each select="exsl:node-set($index-items)/h:li/h:a">
+                  <xsl:variable name="contents" select="."/>
+                  <xsl:choose>
+                    <xsl:when test="$contents=preceding::h:a"/>
+                    <xsl:otherwise>
+                      <li>
+                        <xsl:copy-of select="$contents"/>
+                        <xsl:for-each select="following::h:a[.=$contents]">
+                          <span class="index-counter">
+                            <xsl:text> [</xsl:text>
+                            <a href="{@href}">
+                              <xsl:value-of select="position() + 1"/>
+                            </a>
+                            <xsl:text>]</xsl:text>
+                          </span>
+                        </xsl:for-each>
+                      </li>
+                    </xsl:otherwise>
+                  </xsl:choose>
+                </xsl:for-each>
               </ul>
               <xsl:text>&#10;</xsl:text>
             </xsl:if>

Received on Saturday, 7 August 2010 15:06:30 UTC