- From: Michael Smith via cvs-syncmail <cvsmail@w3.org>
- Date: Tue, 10 Aug 2010 13:51:13 +0000
- To: public-html-commits@w3.org
Update of /sources/public/html5/markup/tools
In directory hutz:/tmp/cvs-serv9081/tools
Modified Files:
chunker.xsl specgen.xsl toc.xsl
Log Message:
build tinkering: only put IDs on links to DFNs, and make sensible IDs (not random-number-like generated ones)
Index: specgen.xsl
===================================================================
RCS file: /sources/public/html5/markup/tools/specgen.xsl,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -d -r1.86 -r1.87
--- specgen.xsl 9 Aug 2010 12:20:32 -0000 1.86
+++ specgen.xsl 10 Aug 2010 13:51:11 -0000 1.87
@@ -18,6 +18,7 @@
<xsl:param name="aria" select="0"/>
<xsl:key name="elements" match="*" use="@id"/>
<xsl:key name="dfn" match="h:dfn" use="substring-after(@id,string-length(@id))"/>
+ <xsl:key name="dfnid" match="h:dfn" use="@id"/>
<xsl:key name="refs" match="h:a[starts-with(@href,'#')]" use="substring-after(@href,'#')"/>
<xsl:key name="chunk" match="*[@id='elements']/h:section
|//h:section[count(ancestor::h:section)=0]
@@ -68,7 +69,7 @@
</xsl:choose>
<xsl:if test="not($chunk=0)">
<link rel="next" href="intro.html" title="intro"/>
- <link rel="index" href="index.html"/>
+ <link rel="index" href="index-of-terms.html"/>
<link rel="contents" href="Overview.html#toc"/>
</xsl:if>
<xsl:if test="$site='whatwg'">
@@ -127,15 +128,15 @@
<xsl:text> </xsl:text>
<div id="index-contents" class="section">
<xsl:text> </xsl:text>
- <h2>Index <a class="hash" href="#index">#</a>
+ <h2>Index of terms <a class="hash" href="#index-of-terms">#</a>
<xsl:text> </xsl:text>
<a class="toc-bak" href="{$TOC-file}#index-toc">T</a>
</h2>
<xsl:text> </xsl:text>
<xsl:for-each select="key('dfn','')">
<xsl:sort select="translate(normalize-space(.),
- 'abcdefghijklmnopqrstuvwxyz',
- 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+ 'abcdefghijklmnopqrstuvwxyz-',
+ 'ABCDEFGHIJKLMNOPQRSTUVWXYZ '
)"/>
<div class="index-entry" id="{@id}_index">
<xsl:text> </xsl:text>
@@ -175,14 +176,14 @@
</xsl:variable>
<xsl:choose>
<xsl:when test="$chunk = 0">
- <div id="index" class="section">
+ <div id="index-of-terms" class="section">
<xsl:copy-of select="exsl:node-set($index-contents)/*/node()"/>
</div>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="write.chunk">
- <xsl:with-param name="id">index</xsl:with-param>
- <xsl:with-param name="filename">index.html</xsl:with-param>
+ <xsl:with-param name="id">index-of-terms</xsl:with-param>
+ <xsl:with-param name="filename">index-of-terms.html</xsl:with-param>
<xsl:with-param name="maturity" select="$maturity"/>
<xsl:with-param name="quiet" select="$quiet"/>
<xsl:with-param name="content" select="$index-contents"/>
@@ -190,8 +191,8 @@
</xsl:call-template>
<xsl:call-template name="write.chunk">
<xsl:with-param name="method">xml</xsl:with-param>
- <xsl:with-param name="filename">index.xhtml</xsl:with-param>
- <xsl:with-param name="id">index</xsl:with-param>
+ <xsl:with-param name="id">index-of-terms</xsl:with-param>
+ <xsl:with-param name="filename">index-of-terms.xhtml</xsl:with-param>
<xsl:with-param name="maturity" select="$maturity"/>
<xsl:with-param name="quiet" select="$quiet"/>
<xsl:with-param name="content" select="$index-contents"/>
@@ -229,7 +230,15 @@
</xsl:for-each>
</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="id" select="generate-id()"/>
+ <xsl:param name="ref" select="substring-after(@href,'#')"/>
+ <xsl:param name="id-of-target">
+ <xsl:for-each select="key('refs',$ref)">
+ <xsl:if test="generate-id() = $id">
+ <xsl:value-of select="concat($ref,'_xref',position())"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:param>
<xsl:param name="section" select="(ancestor::h:section[child::h:h2])[last()]"/>
<xsl:param name="subsection" select="
(ancestor::h:dt
@@ -298,10 +307,10 @@
</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>
+ <a href="{$page/@id}.html#{$id-of-target}"><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>
+ <a href="#{$id-of-target}"><xsl:copy-of select="$link-text"/></a>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
@@ -885,6 +894,7 @@
<xsl:variable name="id">
<xsl:value-of select="generate-id(.)"/>
</xsl:variable>
+ <xsl:variable name="ref" select="substring-after(@href,'#')"/>
<xsl:choose>
<xsl:when test="preceding-sibling::h:span[@class='postfix intermixed']
and ancestor::*[@class='elem-mdl']
@@ -946,9 +956,6 @@
<xsl:when test="$href='syntax'">
<a>
<xsl:copy-of select="@*"/>
- <xsl:attribute name="id">
- <xsl:value-of select="$id"/>
- </xsl:attribute>
<xsl:attribute name="href">
<xsl:text>syntax.html</xsl:text>
</xsl:attribute>
@@ -958,9 +965,6 @@
<xsl:when test="$href='elements'">
<a>
<xsl:copy-of select="@*"/>
- <xsl:attribute name="id">
- <xsl:value-of select="$id"/>
- </xsl:attribute>
<xsl:attribute name="href">
<xsl:text>elements.html</xsl:text>
</xsl:attribute>
@@ -970,9 +974,6 @@
<xsl:when test="$href='html-elements'">
<a>
<xsl:copy-of select="@*"/>
- <xsl:attribute name="id">
- <xsl:value-of select="$id"/>
- </xsl:attribute>
<xsl:attribute name="href">
<xsl:text>elements.html#html-elements</xsl:text>
</xsl:attribute>
@@ -982,9 +983,6 @@
<xsl:when test="$href='common-models'">
<a>
<xsl:copy-of select="@*"/>
- <xsl:attribute name="id">
- <xsl:value-of select="$id"/>
- </xsl:attribute>
<xsl:attribute name="href">
<xsl:text>common-models.html</xsl:text>
</xsl:attribute>
@@ -994,9 +992,6 @@
<xsl:when test="$href='global-attributes'">
<a>
<xsl:copy-of select="@*"/>
- <xsl:attribute name="id">
- <xsl:value-of select="$id"/>
- </xsl:attribute>
<xsl:attribute name="href">
<xsl:text>global-attributes.html</xsl:text>
</xsl:attribute>
@@ -1006,9 +1001,6 @@
<xsl:when test=". ='common.attrs'">
<a>
<xsl:copy-of select="@*"/>
- <xsl:attribute name="id">
- <xsl:value-of select="$id"/>
- </xsl:attribute>
<xsl:attribute name="href">
<xsl:text>global-attributes.html</xsl:text>
</xsl:attribute>
@@ -1019,9 +1011,6 @@
<xsl:when test="$href='forms-attributes'">
<a>
<xsl:copy-of select="@*"/>
- <xsl:attribute name="id">
- <xsl:value-of select="$id"/>
- </xsl:attribute>
<xsl:attribute name="href">
<xsl:text>forms-attributes.html</xsl:text>
</xsl:attribute>
@@ -1041,9 +1030,15 @@
</xsl:if>
<a>
<xsl:copy-of select="@*"/>
- <xsl:attribute name="id">
- <xsl:value-of select="$id"/>
- </xsl:attribute>
+ <xsl:if test="not(@id) and key('dfnid',$ref)">
+ <xsl:for-each select="key('refs',$ref)">
+ <xsl:if test="generate-id() = $id">
+ <xsl:attribute name="id">
+ <xsl:value-of select="concat($ref,'_xref',position())"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:if>
<xsl:attribute name="href">
<xsl:value-of select="concat($section/@id,'.html')"/>
<xsl:value-of select="@href"/>
@@ -1055,9 +1050,6 @@
</xsl:when>
<xsl:when test=". = 'common.attrs'">
<a>
- <xsl:attribute name="id">
- <xsl:value-of select="$id"/>
- </xsl:attribute>
<xsl:attribute name="href">#global-attributes</xsl:attribute>
<xsl:text>global attributes</xsl:text>
</a>
@@ -1066,9 +1058,15 @@
<xsl:otherwise>
<a>
<xsl:copy-of select="@*"/>
- <xsl:attribute name="id">
- <xsl:value-of select="$id"/>
- </xsl:attribute>
+ <xsl:if test="key('dfnid',$ref)">
+ <xsl:for-each select="key('refs',$ref)">
+ <xsl:if test="generate-id() = $id">
+ <xsl:attribute name="id">
+ <xsl:value-of select="concat($ref,'_xref',position())"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:if>
<xsl:apply-templates/>
</a>
</xsl:otherwise>
Index: toc.xsl
===================================================================
RCS file: /sources/public/html5/markup/tools/toc.xsl,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- toc.xsl 4 Aug 2010 12:59:19 -0000 1.22
+++ toc.xsl 10 Aug 2010 13:51:11 -0000 1.23
@@ -22,10 +22,10 @@
</xsl:if>
<xsl:choose>
<xsl:when test="$chunk = 0">
- <a href="#index">Index</a>
+ <a href="#index-of-terms">Index of terms</a>
</xsl:when>
<xsl:otherwise>
- <a href="index.html">Index</a>
+ <a href="index-of-terms.html">Index of terms</a>
</xsl:otherwise>
</xsl:choose>
</li>
Index: chunker.xsl
===================================================================
RCS file: /sources/public/html5/markup/tools/chunker.xsl,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- chunker.xsl 9 Aug 2010 01:03:42 -0000 1.18
+++ chunker.xsl 10 Aug 2010 13:51:11 -0000 1.19
@@ -28,7 +28,7 @@
<xsl:param name="prev"/>
<xsl:param name="next"/>
<xsl:param name="up">Overview.html</xsl:param>
- <xsl:param name="index">index.html</xsl:param>
+ <xsl:param name="index">index-of-terms.html</xsl:param>
<xsl:if test="$quiet = 0">
<xsl:message>
<xsl:value-of select="$filename"/>
Received on Tuesday, 10 August 2010 13:51:16 UTC