html5/markup/tools generate-spec-source.xsl,1.180,1.181

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

Modified Files:
	generate-spec-source.xsl 
Log Message:
h:tml; added processing to take all schema attribute-value
references to relaxng "string" datatype primitive, and transform
them into hyperlinks to the definition of "string" provided in the
Datatypes section.


Index: generate-spec-source.xsl
===================================================================
RCS file: /sources/public/html5/markup/tools/generate-spec-source.xsl,v
retrieving revision 1.180
retrieving revision 1.181
diff -u -d -r1.180 -r1.181
--- generate-spec-source.xsl	16 Jun 2009 10:19:40 -0000	1.180
+++ generate-spec-source.xsl	16 Jun 2009 18:44:27 -0000	1.181
@@ -403,21 +403,10 @@
                     <span class="attr-values">
                       <xsl:text> = </xsl:text>
                       <xsl:for-each select="h:span[@class='model']/node()">
-                      <xsl:choose>
-                        <xsl:when test="name()=''">
-                          <xsl:call-template name="string.subst">
-                            <xsl:with-param name="string" select="."/>
-                            <xsl:with-param name="target">d:string</xsl:with-param>
-                            <xsl:with-param name="replacement"></xsl:with-param>
-                          </xsl:call-template>
-                        </xsl:when>
-                        <xsl:otherwise>
-                          <xsl:copy-of select="."/>
-                        </xsl:otherwise>
-                      </xsl:choose>
-                    </xsl:for-each>
-                  </span>
-                  <a class="hash" href="#{@id}">#</a>
+                        <xsl:call-template name="process.datatype.reference"/>
+                      </xsl:for-each>
+                    </span>
+                    <a class="hash" href="#{@id}">#</a>
                   </dt>
                   <dd>
                     <xsl:copy-of select="document('../src/attributes.html')//h:dd[preceding-sibling::h:dt[@id=current()/@id]]"/>
@@ -459,18 +448,7 @@
                     <span class="attr-values">
                       <xsl:text> = </xsl:text>
                       <xsl:for-each select="h:span[@class='model']/node()">
-                        <xsl:choose>
-                          <xsl:when test="name()=''">
-                            <xsl:call-template name="string.subst">
-                              <xsl:with-param name="string" select="."/>
-                              <xsl:with-param name="target">d:string</xsl:with-param>
-                              <xsl:with-param name="replacement"></xsl:with-param>
-                            </xsl:call-template>
-                          </xsl:when>
-                          <xsl:otherwise>
-                            <xsl:copy-of select="."/>
-                          </xsl:otherwise>
-                        </xsl:choose>
+                        <xsl:call-template name="process.datatype.reference"/>
                       </xsl:for-each>
                     </span>
                     <a class="hash" href="#{@id}">#</a>
@@ -515,33 +493,11 @@
                           ">
                           <xsl:variable name="ref" select="substring-after(@href,'#')"/>
                           <xsl:for-each select="document('../html.rnc.spec.html')//*[@id=$ref]/node()">
-                            <xsl:choose>
-                              <xsl:when test="name()=''">
-                                <xsl:call-template name="string.subst">
-                                  <xsl:with-param name="string" select="."/>
-                                  <xsl:with-param name="target">d:string</xsl:with-param>
-                                  <xsl:with-param name="replacement"></xsl:with-param>
-                                </xsl:call-template>
-                              </xsl:when>
-                              <xsl:otherwise>
-                                <xsl:copy-of select="."/>
-                              </xsl:otherwise>
-                            </xsl:choose>
+                            <xsl:call-template name="process.datatype.reference"/>
                           </xsl:for-each>
                         </xsl:when>
                         <xsl:otherwise>
-                          <xsl:choose>
-                            <xsl:when test="name()=''">
-                              <xsl:call-template name="string.subst">
-                                <xsl:with-param name="string" select="."/>
-                                <xsl:with-param name="target">d:string</xsl:with-param>
-                                <xsl:with-param name="replacement"></xsl:with-param>
-                              </xsl:call-template>
-                            </xsl:when>
-                            <xsl:otherwise>
-                              <xsl:copy-of select="."/>
-                            </xsl:otherwise>
-                          </xsl:choose>
+                          <xsl:call-template name="process.datatype.reference"/>
                         </xsl:otherwise>
                       </xsl:choose>
                     </xsl:for-each>
@@ -2270,20 +2226,12 @@
               <xsl:when test="$ref='form.attrs.method' or $ref='form.attrs.enctype'">
                 <xsl:variable name="datatype" select="concat($ref,'.data')"/>
                 <xsl:for-each select="document('../html.rnc.spec.html')//*[@id=$datatype]/node()">
-                  <xsl:choose>
-                    <xsl:when test="name()=''">
-                      <xsl:call-template name="string.subst">
-                        <xsl:with-param name="string" select="."/>
-                        <xsl:with-param name="target">d:string</xsl:with-param>
-                        <xsl:with-param name="replacement"></xsl:with-param>
-                      </xsl:call-template>
-                    </xsl:when>
-                    <xsl:otherwise>
-                      <xsl:copy-of select="."/>
-                    </xsl:otherwise>
-                  </xsl:choose>
+                  <xsl:call-template name="process.datatype.reference"/>
                 </xsl:for-each>
               </xsl:when>
+              <xsl:when test="normalize-space(//*[@id=$ref]//*[@class='model'])='string'">
+                <a href="#data-string">string</a>
+              </xsl:when>
               <xsl:when
                 test="not(//*[@id=$ref]//*[@class='model']/h:a)">
                 <xsl:call-template name="string.subst">
@@ -2671,6 +2619,24 @@
     </xsl:choose>
   </xsl:template>
   <!-- * ================================================================= -->
+  <xsl:template name="process.datatype.reference">
+    <xsl:choose>
+      <xsl:when test="name()=''">
+        <xsl:call-template name="string.subst">
+          <xsl:with-param name="string" select="."/>
+          <xsl:with-param name="target">d:string</xsl:with-param>
+          <xsl:with-param name="replacement"></xsl:with-param>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="normalize-space(.)='string'">
+        <a href="#data-string">string</a>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:copy-of select="."/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <!-- * ================================================================= -->
   <xsl:template name="substring-after-last">
     <!-- * from XSLT Cookbook -->
     <xsl:param name="input"/>

Received on Tuesday, 16 June 2009 18:44:36 UTC