]> granicus.if.org Git - docbook-dsssl/commitdiff
More elements get common.html.attributes.
authorBob Stayton <bobs@sagehill.net>
Tue, 24 Mar 2009 04:45:34 +0000 (04:45 +0000)
committerBob Stayton <bobs@sagehill.net>
Tue, 24 Mar 2009 04:45:34 +0000 (04:45 +0000)
Added locale.html.attributes template which does the lang,
dir, and title attributes, but not the class attribute
(used on para, for example).

xsl/html/block.xsl
xsl/html/html.xsl
xsl/html/lists.xsl

index 67bc416ac77d53a9c3e11b7ca3782d5e965b148d..62613d476203e26fd09c62bbde6467856e476463 100644 (file)
@@ -23,7 +23,7 @@
 
 <xsl:template name="block.object">
   <div>
-    <xsl:apply-templates select="." mode="class.attribute"/>
+    <xsl:call-template name="common.html.attributes"/>
     <xsl:call-template name="anchor"/>
     <xsl:apply-templates/>
   </div>
 
   <xsl:variable name="p">
     <p>
-      <xsl:call-template name="dir"/>
-      <xsl:if test="$class != ''">
-        <xsl:apply-templates select="." mode="class.attribute">
-          <xsl:with-param name="class" select="$class"/>
-        </xsl:apply-templates>
-      </xsl:if>
+      <xsl:choose>
+        <xsl:when test="$class != ''">
+          <xsl:call-template name="common.html.attributes">
+            <xsl:with-param name="class" select="$class"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="locale.html.attributes"/>
+        </xsl:otherwise>
+      </xsl:choose>
       <xsl:copy-of select="$content"/>
     </p>
   </xsl:variable>
index 9df66349d3f72c23d930fad81286140072dcb4ac..d1be55bd22ca293a2fd53dab0047fa5080272bb8 100644 (file)
 </xsl:template>
 
 <xsl:template name="generate.class.attribute">
-  <xsl:apply-templates select="." mode="class.attribute"/>
+  <xsl:param name="class" select="local-name(.)"/>
+  <xsl:apply-templates select="." mode="class.attribute">
+    <xsl:with-param name="class" select="$class"/>
+  </xsl:apply-templates>
 </xsl:template>
 
 <xsl:template match="*" mode="class.attribute">
 
 <!-- Apply common attributes such as class, lang, dir -->
 <xsl:template name="common.html.attributes">
-  <xsl:apply-templates select="." mode="common.html.attributes"/>
+  <xsl:param name="class" select="local-name(.)"/>
+  <xsl:apply-templates select="." mode="common.html.attributes">
+    <xsl:with-param name="class" select="$class"/>
+  </xsl:apply-templates>
 </xsl:template>
 
 <xsl:template match="*" mode="common.html.attributes">
+  <xsl:param name="class" select="local-name(.)"/>
+  <xsl:call-template name="generate.html.lang"/>
+  <xsl:call-template name="dir"/>
+  <xsl:apply-templates select="." mode="class.attribute">
+    <xsl:with-param name="class" select="$class"/>
+  </xsl:apply-templates>
+  <xsl:call-template name="generate.html.title"/>
+</xsl:template>
+
+<!-- Apply common attributes not including class -->
+<xsl:template name="locale.html.attributes">
+  <xsl:apply-templates select="." mode="locale.html.attributes"/>
+</xsl:template>
+
+<xsl:template match="*" mode="locale.html.attributes">
   <xsl:call-template name="generate.html.lang"/>
   <xsl:call-template name="dir"/>
-  <xsl:call-template name="generate.class.attribute"/>
   <xsl:call-template name="generate.html.title"/>
 </xsl:template>
 
index f728676851ee745cb376416526802d550f7541ac..18fd7aaa4e46d73bf6878477b703783b6dda4cb2 100644 (file)
@@ -16,7 +16,7 @@
 
 <xsl:template match="itemizedlist">
   <div>
-    <xsl:apply-templates select="." mode="class.attribute"/>
+    <xsl:call-template name="common.html.attributes"/>
     <xsl:call-template name="anchor"/>
     <xsl:if test="title">
       <xsl:call-template name="formal.object.heading"/>
@@ -31,6 +31,7 @@
                 |processing-instruction()[not(preceding-sibling::listitem)]"/>
 
     <ul>
+      <xsl:call-template name="common.html.attributes"/>
       <xsl:if test="$css.decoration != 0">
         <xsl:attribute name="type">
           <xsl:call-template name="list.itemsymbol"/>
@@ -81,6 +82,7 @@
   </xsl:variable>
 
   <li>
+    <xsl:call-template name="common.html.attributes"/>
     <xsl:if test="$css.decoration = '1' and $cssmark != ''">
       <xsl:attribute name="style">
         <xsl:text>list-style-type: </xsl:text>
   </xsl:variable>
 
   <div>
-    <xsl:apply-templates select="." mode="class.attribute"/>
+    <xsl:call-template name="common.html.attributes"/>
     <xsl:call-template name="anchor"/>
 
     <xsl:if test="title">
     <xsl:choose>
       <xsl:when test="@inheritnum='inherit' and ancestor::listitem[parent::orderedlist]">
         <table border="0">
+          <xsl:call-template name="common.html.attributes"/>
           <col align="{$direction.align.start}" valign="top"/>
           <tbody>
             <xsl:apply-templates 
       </xsl:when>
       <xsl:otherwise>
         <ol>
+          <xsl:call-template name="common.html.attributes"/>
           <xsl:if test="$start != '1'">
             <xsl:attribute name="start">
               <xsl:value-of select="$start"/>
 
 <xsl:template match="orderedlist/listitem">
   <li>
+    <xsl:call-template name="common.html.attributes"/>
     <xsl:if test="@override">
       <xsl:attribute name="value">
         <xsl:value-of select="@override"/>
   </xsl:variable>
 
   <div>
-    <xsl:apply-templates select="." mode="class.attribute"/>
+    <xsl:call-template name="common.html.attributes"/>
     <xsl:call-template name="anchor"/>
     <xsl:if test="title">
       <xsl:call-template name="formal.object.heading"/>
     </xsl:when>
     <xsl:otherwise>
       <p>
-        <xsl:if test="@role and $para.propagates.style != 0">
-           <xsl:apply-templates select="." mode="class.attribute">
-             <xsl:with-param name="class" select="@role"/>
-           </xsl:apply-templates>
-        </xsl:if>
+        <xsl:choose>
+          <xsl:when test="@role and $para.propagates.style != 0">
+            <xsl:call-template name="common.html.attributes">
+              <xsl:with-param name="class" select="@role"/>
+            </xsl:call-template>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:call-template name="common.html.attributes"/>
+          </xsl:otherwise>
+        </xsl:choose>
 
         <xsl:call-template name="anchor"/>
-        <xsl:apply-templates/>
       </p>
     </xsl:otherwise>
   </xsl:choose>
 
 <xsl:template match="varlistentry/term">
   <span>
-    <xsl:apply-templates select="." mode="class.attribute"/>
+    <xsl:call-template name="common.html.attributes"/>
     <xsl:call-template name="anchor"/>
     <xsl:call-template name="simple.xlink">
       <xsl:with-param name="content">
   <!-- with no type specified, the default is 'vert' -->
   <xsl:call-template name="anchor"/>
   <table border="0" summary="Simple list">
-    <xsl:apply-templates select="." mode="class.attribute"/>
+    <xsl:call-template name="common.html.attributes"/>
     <xsl:call-template name="simplelist.vert">
       <xsl:with-param name="cols">
         <xsl:choose>
 
 <xsl:template match="simplelist[@type='inline']">
   <span>
-    <xsl:apply-templates select="." mode="class.attribute"/>
-  <!-- if dbchoice PI exists, use that to determine the choice separator -->
-  <!-- (that is, equivalent of "and" or "or" in current locale), or literal -->
-  <!-- value of "choice" otherwise -->
-  <xsl:variable name="localized-choice-separator">
-    <xsl:choose>
-      <xsl:when test="processing-instruction('dbchoice')">
-        <xsl:call-template name="select.choice.separator"/>
-      </xsl:when>
-      <xsl:otherwise>
-        <!-- empty -->
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:variable>
-
-  <xsl:for-each select="member">
-    <xsl:call-template name="simple.xlink">
-      <xsl:with-param name="content">
-        <xsl:apply-templates/>
-      </xsl:with-param>
-    </xsl:call-template>
-    <xsl:choose>
-      <xsl:when test="position() = last()"/> <!-- do nothing -->
-      <xsl:otherwise>
-        <xsl:text>, </xsl:text>
-        <xsl:if test="position() = last() - 1">
-          <xsl:if test="$localized-choice-separator != ''">
-            <xsl:value-of select="$localized-choice-separator"/>
-            <xsl:text> </xsl:text>
+    <xsl:call-template name="common.html.attributes"/>
+    <!-- if dbchoice PI exists, use that to determine the choice separator -->
+    <!-- (that is, equivalent of "and" or "or" in current locale), or literal -->
+    <!-- value of "choice" otherwise -->
+    <xsl:variable name="localized-choice-separator">
+      <xsl:choose>
+        <xsl:when test="processing-instruction('dbchoice')">
+          <xsl:call-template name="select.choice.separator"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <!-- empty -->
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+  
+    <xsl:for-each select="member">
+      <xsl:call-template name="simple.xlink">
+        <xsl:with-param name="content">
+          <xsl:apply-templates/>
+        </xsl:with-param>
+      </xsl:call-template>
+      <xsl:choose>
+        <xsl:when test="position() = last()"/> <!-- do nothing -->
+        <xsl:otherwise>
+          <xsl:text>, </xsl:text>
+          <xsl:if test="position() = last() - 1">
+            <xsl:if test="$localized-choice-separator != ''">
+              <xsl:value-of select="$localized-choice-separator"/>
+              <xsl:text> </xsl:text>
+            </xsl:if>
           </xsl:if>
-        </xsl:if>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:for-each>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each>
   </span>
 </xsl:template>
 
 <xsl:template match="simplelist[@type='horiz']">
   <xsl:call-template name="anchor"/>
   <table border="0" summary="Simple list">
-    <xsl:apply-templates select="." mode="class.attribute"/>
+    <xsl:call-template name="common.html.attributes"/>
     <xsl:call-template name="simplelist.horiz">
       <xsl:with-param name="cols">
         <xsl:choose>
 <xsl:template match="simplelist[@type='vert']">
   <xsl:call-template name="anchor"/>
   <table border="0" summary="Simple list">
-    <xsl:apply-templates select="." mode="class.attribute"/>
+    <xsl:call-template name="common.html.attributes"/>
     <xsl:call-template name="simplelist.vert">
       <xsl:with-param name="cols">
         <xsl:choose>
     <xsl:choose>
       <xsl:when test="count(step) = 1">
         <ul>
+          <xsl:call-template name="common.html.attributes"/>
           <xsl:apply-templates 
             select="step
                     |comment()[preceding-sibling::step]
       </xsl:when>
       <xsl:otherwise>
         <ol>
+          <xsl:call-template name="common.html.attributes"/>
           <xsl:attribute name="type">
             <xsl:value-of select="substring($procedure.step.numeration.formats,1,1)"/>
           </xsl:attribute>
 <xsl:template match="stepalternatives">
   <xsl:call-template name="anchor"/>
   <ul>
+    <xsl:call-template name="common.html.attributes"/>
     <xsl:apply-templates/>
   </ul>
 </xsl:template>
 
 <xsl:template match="step/title">
   <p>
-    <xsl:apply-templates select="." mode="class.attribute"/>
+    <xsl:call-template name="common.html.attributes"/>
     <b>
       <xsl:apply-templates/>
     </b>
   </xsl:variable>
 
   <div>
-    <xsl:apply-templates select="." mode="class.attribute"/>
+    <xsl:call-template name="common.html.attributes"/>
     <xsl:call-template name="anchor"/>
 
     <xsl:choose>
 
 <xsl:template match="segmentedlist/title">
   <div>
-    <xsl:apply-templates select="." mode="class.attribute"/>
+    <xsl:call-template name="common.html.attributes"/>
     <strong>
       <span>
-        <xsl:apply-templates select="." mode="class.attribute"/>
+        <xsl:call-template name="common.html.attributes"/>
         <xsl:apply-templates/>
       </span>
     </strong>
 
 <xsl:template match="seglistitem">
   <div>
-    <xsl:apply-templates select="." mode="class.attribute"/>
+    <xsl:call-template name="common.html.attributes"/>
     <xsl:call-template name="anchor"/>
     <xsl:apply-templates/>
   </div>
   -->
 
   <div>
-    <xsl:apply-templates select="." mode="class.attribute"/>
+    <xsl:call-template name="common.html.attributes"/>
     <strong>
       <span class="segtitle">
         <xsl:apply-templates select="$segtitles[$segnum=position()]"
   </xsl:variable>
 
   <tr>
-    <xsl:apply-templates select="." mode="class.attribute"/>
+    <xsl:call-template name="common.html.attributes"/>
     <xsl:call-template name="tr.attributes">
       <xsl:with-param name="rownum" select="$seglinum + 1"/>
     </xsl:call-template>
 
 <xsl:template match="seg" mode="seglist-table">
   <td>
-    <xsl:apply-templates select="." mode="class.attribute"/>
+    <xsl:call-template name="common.html.attributes"/>
     <xsl:apply-templates/>
   </td>
 </xsl:template>
 
 <xsl:template match="seg[1]" mode="seglist-table">
   <td>
-    <xsl:apply-templates select="." mode="class.attribute"/>
+    <xsl:call-template name="common.html.attributes"/>
     <xsl:call-template name="anchor">
       <xsl:with-param name="node" select="ancestor::seglistitem"/>
     </xsl:call-template>
 
 <xsl:template match="calloutlist">
   <div>
-    <xsl:apply-templates select="." mode="class.attribute"/>
+    <xsl:call-template name="common.html.attributes"/>
     <xsl:call-template name="anchor"/>
     <xsl:if test="title|info/title">
       <xsl:call-template name="formal.object.heading"/>
     <xsl:otherwise>
       <p>
         <xsl:if test="@role and $para.propagates.style != 0">
-          <xsl:apply-templates select="." mode="class.attribute">
-            <xsl:with-param name="class" select="@role"/>
-          </xsl:apply-templates>
+          <xsl:choose>
+            <xsl:when test="@role and $para.propagates.style != 0">
+              <xsl:call-template name="common.html.attributes">
+                <xsl:with-param name="class" select="@role"/>
+              </xsl:call-template>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:call-template name="common.html.attributes"/>
+            </xsl:otherwise>
+          </xsl:choose>
         </xsl:if>
 
         <xsl:call-template name="anchor"/>