W3C home > Mailing lists > Public > public-html-commits@w3.org > July 2010

html5/markup/tools generate-spec-source.xsl,1.279,1.280

From: Michael Smith via cvs-syncmail <cvsmail@w3.org>
Date: Sat, 31 Jul 2010 08:13:18 +0000
To: public-html-commits@w3.org
Message-Id: <E1Of7C2-0004Pl-Pn@lionel-hutz.w3.org>
Update of /sources/public/html5/markup/tools
In directory hutz:/tmp/cvs-serv15998/tools

Modified Files:
	generate-spec-source.xsl 
Log Message:
removed "Form attributes" section, and moved all shared form attribute descriptions to the individual element pages; this required changing a bunch of IDs
also changed to using hash-on-hover linking on all attribute descriptions


Index: generate-spec-source.xsl
===================================================================
RCS file: /sources/public/html5/markup/tools/generate-spec-source.xsl,v
retrieving revision 1.279
retrieving revision 1.280
diff -u -d -r1.279 -r1.280
--- generate-spec-source.xsl	30 Jul 2010 10:34:16 -0000	1.279
+++ generate-spec-source.xsl	31 Jul 2010 08:13:16 -0000	1.280
@@ -2186,14 +2186,18 @@
               <div class="attr-content-models">
               <p>
               <span class="pattern" id="colgroup.attrs">
-              <a href="#global-attributes">global attributes</a>
+                <a class="ref"
+                  title="global-attributes"
+                  href="#global-attributes">global attributes</a>
               <span class="postfix optional">?</span>
               <xsl:text> </xsl:text>
               <span class="postfix intermixed">&amp;</span>
               <xsl:text> </xsl:text>
               <span class="postfix optional">?</span>
               <xsl:text> </xsl:text>
-              <a href="#colgroup.attrs.span">span</a>
+              <a class="ref"
+                title="colgroup.attrs.span"
+                href="#colgroup.attrs.span">span</a>
               <span class="postfix optional">?</span>
               </span>
               </p>
@@ -2231,28 +2235,29 @@
             <xsl:when test="@name='li'">
               <div class="attr-content-models">
                 <p>
-                  <a href="#global-attributes">global attributes</a>
+                  <a class="ref"
+                    title="global-attributes"
+                    href="#global-attributes">global attributes</a>
                   <span class="postfix optional">?</span>
                   <xsl:text> </xsl:text>
                   <span class="postfix &amp;">&amp;</span>
                   <xsl:text> </xsl:text>
-                  <a href="#oli.attrs.value">value</a>
+                  <a
+                    class="ref"
+                    title="li.attrs.value"
+                    href="#li.attrs.value">value</a>
                   <span class="postfix optional">?</span>
                 </p>
               </div>
             </xsl:when>
             <xsl:otherwise>
+              <xsl:for-each select="$rnc-html">
               <div>
                 <xsl:attribute name="class">attr-content-models</xsl:attribute>
-                <xsl:for-each select="$rnc-html//*[starts-with(@id,$name-dot)
+                <xsl:for-each select="//*[starts-with(@id,$name-dot)
                   and substring(@id,string-length(@id)-4)='attrs']">
                   <xsl:text>&#10;          </xsl:text>
                   <p>
-                    <!-- * <a href="#{@id}" -->
-                      <!-- * > -->
-                      <!-- * <xsl:value-of select="@id"/> -->
-                    <!-- * </a> -->
-                    <!-- * <xsl:text> = </xsl:text> -->
                         <xsl:variable name="ref" select="@id"/>
                         <xsl:choose>
                           <xsl:when test="starts-with($ref,'meta.')">
@@ -2276,33 +2281,81 @@
                               </xsl:choose>
                             </xsl:for-each>
                           </xsl:when>
-                          <xsl:when test="$rnc-html//h:*[@id = $ref]//h:a[@href='#common-form.attrs']">
+                          <xsl:when test="
+                            key('elements',$ref)//h:a[@href='#common-form.attrs']
+                            or key('elements',$ref)//h:a[starts-with(@href,'#shared-form.attrs')]
+                            or key('elements',$ref)//h:a[starts-with(@href,'#common-form.attrs')]
+                            or key('elements',$ref)//h:a[starts-with(@href,'#input.attrs')]
+                            ">
                             <span class="pattern" id="{@id}">
-                              <xsl:for-each select="$rnc-html//h:*[@id = $ref]/node()">
+                              <xsl:for-each select="key('elements',$ref)/node()">
                                 <xsl:choose>
                                   <xsl:when test="@class='agroupof'">
+                                    <span class="agroupof">
                                     <xsl:for-each select="node()">
                                       <xsl:choose>
                                         <xsl:when test="@href='#common-form.attrs'">
-                                          <xsl:for-each
-                                            select="$rnc-html//h:*[@id = 'common-form.attrs']/node()">
-                                            <xsl:copy-of select="."/>
+                                          <xsl:for-each select="key('elements','common-form.attrs')/node()">
+                                            <xsl:call-template name="pack-common-attribute">
+                                              <xsl:with-param name="name" select="$name"/>
+                                              <xsl:with-param name="prefix">#common-form.attrs.</xsl:with-param>
+                                            </xsl:call-template>
                                           </xsl:for-each>
                                         </xsl:when>
+                                        <xsl:when test="starts-with(@href,'#common-form.attrs')">
+                                          <xsl:call-template name="pack-common-attribute">
+                                            <xsl:with-param name="name" select="$name"/>
+                                            <xsl:with-param name="prefix">#common-form.attrs.</xsl:with-param>
+                                          </xsl:call-template>
+                                        </xsl:when>
+                                        <xsl:when test="starts-with(@href,'#shared-form.attrs')">
+                                          <xsl:call-template name="pack-common-attribute">
+                                            <xsl:with-param name="name" select="$name"/>
+                                            <xsl:with-param name="prefix">#shared-form.attrs.</xsl:with-param>
+                                          </xsl:call-template>
+                                        </xsl:when>
+                                        <xsl:when test="starts-with(@href,'#input.attrs')">
+                                          <xsl:call-template name="pack-common-attribute">
+                                            <xsl:with-param name="name" select="$name"/>
+                                            <xsl:with-param name="prefix">#input.attrs.</xsl:with-param>
+                                          </xsl:call-template>
+                                        </xsl:when>
                                         <xsl:otherwise>
                                           <xsl:copy-of select="."/>
                                         </xsl:otherwise>
                                       </xsl:choose>
                                     </xsl:for-each>
+                                  </span>
                                   </xsl:when>
                                   <xsl:otherwise>
                                     <xsl:choose>
                                       <xsl:when test="@href='#common-form.attrs'">
                                         <xsl:for-each
-                                          select="$rnc-html//h:*[@id = 'common-form.attrs']/node()">
-                                          <xsl:copy-of select="."/>
+                                          select="key('elements','common-form.attrs')/node()">
+                                          <xsl:call-template name="pack-common-attribute">
+                                            <xsl:with-param name="name" select="$name"/>
+                                            <xsl:with-param name="prefix">#common-form.attrs.</xsl:with-param>
+                                          </xsl:call-template>
                                         </xsl:for-each>
                                       </xsl:when>
+                                      <xsl:when test="starts-with(@href,'#common-form.attrs')">
+                                        <xsl:call-template name="pack-common-attribute">
+                                          <xsl:with-param name="name" select="$name"/>
+                                          <xsl:with-param name="prefix">#common-form.attrs.</xsl:with-param>
+                                        </xsl:call-template>
+                                      </xsl:when>
+                                      <xsl:when test="starts-with(@href,'#shared-form.attrs')">
+                                        <xsl:call-template name="pack-common-attribute">
+                                          <xsl:with-param name="name" select="$name"/>
+                                          <xsl:with-param name="prefix">#shared-form.attrs.</xsl:with-param>
+                                        </xsl:call-template>
+                                      </xsl:when>
+                                      <xsl:when test="starts-with(@href,'#input.attrs')">
+                                        <xsl:call-template name="pack-common-attribute">
+                                          <xsl:with-param name="name" select="$name"/>
+                                          <xsl:with-param name="prefix">#input.attrs.</xsl:with-param>
+                                        </xsl:call-template>
+                                      </xsl:when>
                                       <xsl:otherwise>
                                         <xsl:copy-of select="."/>
                                       </xsl:otherwise>
@@ -2317,13 +2370,19 @@
                             <xsl:if test="$name = 'audio'">
                               <span class="postfix intermixed">&amp;</span>
                               <xsl:text> </xsl:text>
-                              <a href="#audio.attrs.src">src</a>
+                              <a
+                                class="ref"
+                                title="video.attrs.src"
+                                href="#audio.attrs.src">src</a>
                               <span class="postfix optional">?</span>
                             </xsl:if>
                             <xsl:if test="$name = 'video'">
                               <span class="postfix intermixed">&amp;</span>
                               <xsl:text> </xsl:text>
-                              <a href="#video.attrs.src">src</a>
+                              <a
+                                class="ref"
+                                title="video.attrs.src"
+                                href="#video.attrs.src">src</a>
                               <span class="postfix optional">?</span>
                             </xsl:if>
                           </xsl:otherwise>
@@ -2334,27 +2393,31 @@
                   </xsl:if>
                 </xsl:for-each>
               </div>
+            </xsl:for-each>
             </xsl:otherwise>
           </xsl:choose>
         </xsl:when>
-        <xsl:when test="$rnc-html//*[@id = 'script.attrs.embedded'
-          or @id = 'script.attrs.imported']">
+        <xsl:otherwise>
+          <xsl:for-each select="$rnc-html">
           <div class="attr-content-models">
-            <xsl:for-each select="$rnc-html//*[@id = 'script.attrs.embedded'
-              or @id = 'script.attrs.imported']">
+            <xsl:for-each select="key('elements','script.attrs.embedded')">
+              <xsl:text>&#10;          </xsl:text>
+              <p>
+                <xsl:copy-of select="node()"/>
+              </p>
+            </xsl:for-each>
+            <xsl:text>&#10;        </xsl:text>
+            <div class="postfix or">or</div>
+            <xsl:for-each select="key('elements','script.attrs.imported')">
               <xsl:text>&#10;          </xsl:text>
-              <!-- * <dt class="attr-content-model"> -->
-                <!-- * <span class="attribute-pattern-name" id="{@id}"> -->
-                  <!-- * <xsl:value-of select="@id"/> = -->
-                <!-- * </span> -->
-              <!-- * </dt> -->
               <p>
                 <xsl:copy-of select="node()"/>
               </p>
             </xsl:for-each>
             <xsl:text>&#10;        </xsl:text>
           </div>
-        </xsl:when>
+        </xsl:for-each>
+        </xsl:otherwise>
       </xsl:choose>
     </xsl:variable>
     <div class="no-number no-toc" id="{$name}-attributes">
@@ -2503,7 +2566,16 @@
   <xsl:template name="make.attribute.definition">
     <xsl:param name="name"/>
     <xsl:param name="attribute-name" select="."/>
-    <xsl:param name="href" select="@href"/>
+    <xsl:param name="href">
+      <xsl:choose>
+        <xsl:when test="not(@class = 'ref')">
+          <xsl:value-of select="@class"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="@href"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:param>
     <xsl:choose>
       <xsl:when
         test="(not(preceding::*[@href=$href])
@@ -2564,11 +2636,11 @@
               </xsl:if>
             </xsl:variable>
             <xsl:if test="not($filename='')">
-              <span class="spec-link">
-                <a title="Read about this attribute in the HTML5 spec"
-                  href="{$filename}.html{$spec-target}">&#9432;</a>
-              </span>
-              <xsl:text> </xsl:text>
+              <a
+                class="spec-link"
+                title="Read about this attribute in the HTML5 spec"
+                href="{$filename}.html{$spec-target}">&#9432;</a>
+              <xsl:text>&#10;</xsl:text>
             </xsl:if>
             <xsl:choose>
               <xsl:when test="$ref = 'common.attrs'">
@@ -2584,10 +2656,7 @@
                 </xsl:call-template>
               </xsl:when>
               <xsl:when test="contains(node(),'.')">
-                <a class="attribute-name"
-                  id="{$ref}"
-                  title="{$ref}"
-                  href="#{$ref}">
+                <span class="attribute-name">
                   <xsl:choose>
                     <xsl:when test="starts-with(node(),'wrap.')">
                       <xsl:text>wrap</xsl:text> 
@@ -2632,28 +2701,19 @@
                       </xsl:call-template>
                     </xsl:otherwise>
                   </xsl:choose>
-                </a>
+                </span>
               </xsl:when>
               <xsl:when test="starts-with($ref,'button.')
                 or starts-with($ref,'input.')
                 or starts-with($ref,'command.')
                 or starts-with($ref,'meta.')
                 ">
-                <a class="attribute-name"
-                  id="{$ref}"
-                  title="{$ref}"
-                  href="#{$ref}">
+                <span class="attribute-name">
                   <xsl:copy-of select="node()"/>
-                </a>
+                </span>
               </xsl:when>
               <xsl:otherwise>
-                <xsl:variable name="adj-ref">
-                  <xsl:value-of select="$ref"/>
-                </xsl:variable>
-                <a class="attribute-name"
-                  id="{$adj-ref}"
-                  title="{$adj-ref}"
-                  href="#{$adj-ref}">
+                <span class="attribute-name">
                   <xsl:choose>
                     <xsl:when test="$ref='common.attrs.xml-id'">
                       <xsl:text>xml:id</xsl:text>
@@ -2671,7 +2731,7 @@
                       <xsl:copy-of select="node()"/>
                     </xsl:otherwise>
                   </xsl:choose>
-                </a>
+                </span>
               </xsl:otherwise>
             </xsl:choose>
           <xsl:variable name="model">
@@ -2680,6 +2740,7 @@
           </xsl:variable>
           <xsl:choose>
             <xsl:when test="$ref = 'common.attrs'
+              or $ref='global-attributes'
               or starts-with($ref,'area.attrs.shape.')
               "/>
           <xsl:otherwise>
@@ -2866,6 +2927,12 @@
               title="This markup feature has been obsoleted in HTML5."
               >OBSOLETE</span>
           </xsl:if>
+          <xsl:text>&#10;</xsl:text>
+          <a class="hash"
+            id="{substring-after(@href,'#')}"
+            title="{substring-after(@href,'#')}"
+            href="{@href}">#</a>
+          <xsl:text>&#10;</xsl:text>
           </xsl:otherwise>
           </xsl:choose>
         </dt>
@@ -3552,4 +3619,25 @@
   <xsl:template match="node()[normalize-space(.)='empty']">
     <span>empty (<a href="#void-element">void element</a>)</span>
   </xsl:template>
+
+  <xsl:template name="pack-common-attribute">
+    <xsl:param name="name"/>
+    <xsl:param name="prefix"/>
+    <xsl:choose>
+      <xsl:when test="@href">
+        <xsl:variable name="target">
+          <xsl:value-of select="concat($name,'.attrs.',substring-after(@href,$prefix))"/>
+        </xsl:variable>
+        <a class="{@href}"
+          title="{$target}"
+          href="#{$target}">
+          <xsl:copy-of select="node()"/>
+        </a>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:copy-of select="."/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
 </xsl:stylesheet>
Received on Saturday, 31 July 2010 08:13:21 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 31 July 2010 08:13:29 GMT