- From: Michael Smith via cvs-syncmail <cvsmail@w3.org>
- Date: Sun, 08 Aug 2010 09:49:22 +0000
- To: public-html-commits@w3.org
Update of /sources/public/html5/markup/tools In directory hutz:/tmp/cvs-serv30660/tools Modified Files: specgen.xsl Log Message: further knob-turning of index and references sections Index: specgen.xsl =================================================================== RCS file: /sources/public/html5/markup/tools/specgen.xsl,v retrieving revision 1.82 retrieving revision 1.83 diff -u -d -r1.82 -r1.83 --- specgen.xsl 7 Aug 2010 15:06:26 -0000 1.82 +++ specgen.xsl 8 Aug 2010 09:49:20 -0000 1.83 @@ -130,7 +130,7 @@ </xsl:template> <xsl:template name="make-index"> <xsl:variable name="index-contents"> - <xsl:text> </xsl:text> + <xsl:text> </xsl:text> <div id="index-contents" class="section"> <xsl:text> </xsl:text> <h2>Index <a class="hash" href="#index">#</a> @@ -150,109 +150,29 @@ <div class="index-entry"> <xsl:text> </xsl:text> <p> - <a> - <xsl:attribute name="href"> - <xsl:choose> - <xsl:when test="$chunk = 0"> - <xsl:value-of select="concat('#',@id)"/> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="concat($sourcepage/@id,'.html#',@id)"/> - </xsl:otherwise> - </xsl:choose> - </xsl:attribute> - <xsl:value-of select="normalize-space(.)"/> - <xsl:if test="starts-with(@id,'refs')"> - <xsl:text> (specification)</xsl:text> - </xsl:if> - </a> + <xsl:value-of select="normalize-space(.)"/> + <xsl:if test="starts-with(@id,'refs')"> + <xsl:text> (specification)</xsl:text> + </xsl:if> </p> <xsl:text> </xsl:text> - <xsl:if test="count(key('refs',@id)) > 0"> - <xsl:variable name="index-items"> - <xsl:text> </xsl:text> - <xsl:for-each select="key('refs',@id)"> - <xsl:variable name="href" select="@href"/> - <xsl:variable name="id" select="generate-id(.)"/> - <xsl:variable name="ref" select="substring-after(@href,'#')"/> - <xsl:variable name="section" select="(ancestor::h:section[child::h:h2])[last()]"/> - <xsl:variable name="page" - select="key('elements',$section/@id)/ancestor-or-self::h:section[child::h:h2[@class='element-head']] - |key('elements',$section/@id)/ancestor-or-self::h:section[(count(ancestor::h:section)=0 and not(@id='elements'))] - "/> - <xsl:variable name="subsection" select=" - (ancestor::h:dt - |ancestor::h:dd/preceding-sibling::h:dt[1] - |(ancestor::h:*[child::h:h2])[last()])[last()] - "/> - <xsl:variable name="link-text"> - <xsl:choose> - <xsl:when test="$section/*/h:span[@class='element']"> - <xsl:copy-of select="$section/*/h:span[@class='element']"/> - <xsl:if test="$section/*/h:span[@class='elem-qualifier']"> - <xsl:copy-of select="$section/*/h:span[@class='elem-qualifier']"/> - </xsl:if> - <xsl:text> element</xsl:text> - </xsl:when> - <xsl:when test="$section/*[@class='datatype-desc']"> - <cite class="index"> - <xsl:value-of select="normalize-space($section/h:h2)"/> - </cite> - <xsl:text> data type</xsl:text> - </xsl:when> - <xsl:otherwise> - <cite class="index"> - <xsl:value-of select="normalize-space($section/h:h2)"/> - </cite> - <xsl:text> section</xsl:text> - </xsl:otherwise> - </xsl:choose> - <xsl:choose> - <xsl:when test="$subsection/@id = $section/@id"/> - <xsl:otherwise> - <xsl:text>: </xsl:text> - <xsl:choose> - <xsl:when test="$subsection/h:h2"> - <cite class="index"> - <xsl:value-of select="normalize-space($subsection/h:h2)"/> - </cite> - </xsl:when> - <xsl:when test="$subsection/self::h:dt"> - <xsl:choose> - <xsl:when test="$subsection//*[@class='qualified-attribute']"> - <xsl:copy-of select="$subsection//*[@class='qualified-attribute']"/> - <xsl:text> attribute </xsl:text> - </xsl:when> - <xsl:when test="$subsection//*[@class='attribute-name']"> - <xsl:copy-of select="$subsection//*[@class='attribute-name']"/> - <xsl:text> attribute</xsl:text> - </xsl:when> - <xsl:otherwise> - <cite class="index-dfn"> - <xsl:value-of select="normalize-space($subsection)"/> - </cite> - </xsl:otherwise> - </xsl:choose> - </xsl:when> - <xsl:otherwise> - <xsl:text>@@FIXME@@</xsl:text> - </xsl:otherwise> - </xsl:choose> - </xsl:otherwise> - </xsl:choose> - </xsl:variable> - <xsl:choose> - <xsl:when test="not($chunk = 0)"> - <li><a href="{$page/@id}.html#{$id}"><xsl:copy-of select="$link-text"/></a></li> - </xsl:when> - <xsl:otherwise> - <li><a href="#{$id}"><xsl:copy-of select="$link-text"/></a></li> - </xsl:otherwise> - </xsl:choose> - </xsl:for-each> - <xsl:text> </xsl:text> - </xsl:variable> - <ul> + <ul> + <xsl:text> </xsl:text> + <li> + <xsl:call-template name="make-link-with-name-of-named-ancestor-of-node"> + <xsl:with-param name="id-of-target" select="@id"/> + </xsl:call-template> + <xsl:text> </xsl:text> + <span class="index-notation">(defining instance)</span></li> + <xsl:text> </xsl:text> + <xsl:if test="count(key('refs',@id)) > 0"> + <xsl:variable name="index-items"> + <xsl:text> </xsl:text> + <xsl:for-each select="key('refs',@id)"> + <li><xsl:call-template name="make-link-with-name-of-named-ancestor-of-node"/></li> + </xsl:for-each> + <xsl:text> </xsl:text> + </xsl:variable> <xsl:for-each select="exsl:node-set($index-items)/h:li/h:a"> <xsl:variable name="contents" select="."/> <xsl:choose> @@ -273,9 +193,10 @@ </xsl:otherwise> </xsl:choose> </xsl:for-each> - </ul> - <xsl:text> </xsl:text> - </xsl:if> + <xsl:text> </xsl:text> + </xsl:if> + </ul> + <xsl:text> </xsl:text> </div> <xsl:text> </xsl:text> </xsl:for-each> @@ -300,6 +221,83 @@ </xsl:otherwise> </xsl:choose> </xsl:template> + <xsl:template name="make-link-with-name-of-named-ancestor-of-node"> + <xsl:param name="id-of-target" select="generate-id()"/> + <xsl:param name="section" select="(ancestor::h:section[child::h:h2])[last()]"/> + <xsl:param name="subsection" select=" + (ancestor::h:dt + |ancestor::h:dd/preceding-sibling::h:dt[1] + |(ancestor::h:*[child::h:h2])[last()])[last()] + "/> + <xsl:param name="page" + select="key('elements',$section/@id)/ancestor-or-self::h:section[child::h:h2[@class='element-head']] + |key('elements',$section/@id)/ancestor-or-self::h:section[(count(ancestor::h:section)=0 and not(@id='elements'))] + "/> + <xsl:variable name="link-text"> + <xsl:choose> + <xsl:when test="$section/*/h:span[@class='element']"> + <xsl:copy-of select="$section/*/h:span[@class='element']"/> + <xsl:if test="$section/*/h:span[@class='elem-qualifier']"> + <xsl:copy-of select="$section/*/h:span[@class='elem-qualifier']"/> + </xsl:if> + <xsl:text> element</xsl:text> + </xsl:when> + <xsl:when test="$section/*[@class='datatype-desc']"> + <cite class="index"> + <xsl:value-of select="normalize-space($section/h:h2)"/> + </cite> + <xsl:text> data type</xsl:text> + </xsl:when> + <xsl:otherwise> + <cite class="index"> + <xsl:value-of select="normalize-space($section/h:h2)"/> + </cite> + <xsl:text> section</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="$subsection/@id = $section/@id"/> + <xsl:otherwise> + <xsl:text>: </xsl:text> + <xsl:choose> + <xsl:when test="$subsection/h:h2"> + <cite class="index"> + <xsl:value-of select="normalize-space($subsection/h:h2)"/> + </cite> + </xsl:when> + <xsl:when test="$subsection/self::h:dt"> + <xsl:choose> + <xsl:when test="$subsection//*[@class='qualified-attribute']"> + <xsl:copy-of select="$subsection//*[@class='qualified-attribute']"/> + <xsl:text> attribute </xsl:text> + </xsl:when> + <xsl:when test="$subsection//*[@class='attribute-name']"> + <xsl:copy-of select="$subsection//*[@class='attribute-name']"/> + <xsl:text> attribute</xsl:text> + </xsl:when> + <xsl:otherwise> + <cite class="index-dfn"> + <xsl:value-of select="normalize-space($subsection)"/> + </cite> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:text>@@FIXME@@</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="not($chunk = 0)"> + <a href="{$page/@id}.html#{$id-of-target}" id="{generate-id()}"><xsl:copy-of select="$link-text"/></a> + </xsl:when> + <xsl:otherwise> + <a href="#{$id-of-target}" id="{generate-id()}"><xsl:copy-of select="$link-text"/></a> + </xsl:otherwise> + </xsl:choose> + </xsl:template> <xsl:template name='top'> <div id="jump-indexes" class="no-number no-toc"> <div id="jumpIndexA-button">jump</div>
Received on Sunday, 8 August 2010 09:49:24 UTC