[yelp-xsl] Added html.class.attr and html.class.attr.mode



commit 6e44d4ea2ba0b8233106584497de279698bb1afa
Author: Shaun McCance <shaunm gnome org>
Date:   Sat Jul 13 11:20:40 2013 -0400

    Added html.class.attr and html.class.attr.mode
    
    This is now used throughout all the stylesheets to output the
    class attribute for HTML elements that correspond directly to
    some source element. This makes it much easier for extensions
    to add extra classes for styling based on various conditions.

 xslt/common/html.xsl                        |   46 ++++++
 xslt/dita/html/dita2html-block.xsl          |   58 ++++---
 xslt/dita/html/dita2html-inline.xsl         |    8 +-
 xslt/dita/html/dita2html-list.xsl           |   90 ++++++++--
 xslt/dita/html/dita2html-media.xsl          |   39 +++--
 xslt/dita/html/dita2html-table.xsl          |    8 +-
 xslt/dita/html/dita2html-topic.xsl          |   31 +++-
 xslt/docbook/html/db2html-bibliography.xsl  |   15 ++-
 xslt/docbook/html/db2html-block.xsl         |   62 ++++++--
 xslt/docbook/html/db2html-callout.xsl       |    5 +-
 xslt/docbook/html/db2html-classsynopsis.xsl |   20 ++-
 xslt/docbook/html/db2html-cmdsynopsis.xsl   |   21 ++-
 xslt/docbook/html/db2html-division.xsl      |   11 +-
 xslt/docbook/html/db2html-ebnf.xsl          |    5 +-
 xslt/docbook/html/db2html-footnote.xsl      |    6 +-
 xslt/docbook/html/db2html-inline.xsl        |    6 +-
 xslt/docbook/html/db2html-list.xsl          |  112 ++++++++++---
 xslt/docbook/html/db2html-math.xsl          |    6 +-
 xslt/docbook/html/db2html-media.xsl         |   40 ++++-
 xslt/docbook/html/db2html-refentry.xsl      |    5 +-
 xslt/docbook/html/db2html-table.xsl         |   46 ++++--
 xslt/docbook/html/db2html-xref.xsl          |   15 ++-
 xslt/mallard/html/mal2html-block.xsl        |  233 +++++++++++++++------------
 xslt/mallard/html/mal2html-gloss.xsl        |    5 +-
 xslt/mallard/html/mal2html-inline.xsl       |   14 +-
 xslt/mallard/html/mal2html-links.xsl        |   27 ++--
 xslt/mallard/html/mal2html-list.xsl         |  174 +++++++++++---------
 xslt/mallard/html/mal2html-math.xsl         |    5 +-
 xslt/mallard/html/mal2html-media.xsl        |  187 +++++++++++----------
 xslt/mallard/html/mal2html-page.xsl         |   52 ++----
 xslt/mallard/html/mal2html-svg.xsl          |   47 +++---
 xslt/mallard/html/mal2html-table.xsl        |   58 ++++---
 32 files changed, 920 insertions(+), 537 deletions(-)
---
diff --git a/xslt/common/html.xsl b/xslt/common/html.xsl
index 90917c7..aa12991 100644
--- a/xslt/common/html.xsl
+++ b/xslt/common/html.xsl
@@ -460,6 +460,52 @@ to provide additional elements in the HTML #{head} element of output files.
 
 
 <!--**==========================================================================
+html.class.attr
+Output a #{class} attribute for an HTML element.
+:Revision: version="3.10" date="2013-07-10" status="final"
+$node: The source node for which an HTML element is being output.
+$class: The value of the #{class} attribute provided by the calling template.
+
+This template is called by templates that output an HTML element corresponding
+to a source element. This template applies %{html.class.attr.mode} to ${node}
+to gather a value from extensions stylesheets. It combines this value with the
+value passed in the ${class} parameter and, if the result is non-empty, outputs
+a #{class} attribute.
+-->
+<xsl:template name="html.class.attr">
+  <xsl:param name="node" select="."/>
+  <xsl:param name="class"/>
+  <xsl:variable name="fclass">
+    <xsl:value-of select="$class"/>
+    <xsl:text> </xsl:text>
+    <xsl:apply-templates mode="html.class.attr.mode" select="$node"/>
+  </xsl:variable>
+  <xsl:variable name="nclass" select="normalize-space($fclass)"/>
+  <xsl:if test="$nclass != ''">
+    <xsl:attribute name="class">
+      <xsl:value-of select="$nclass"/>
+    </xsl:attribute>
+  </xsl:if>
+</xsl:template>
+
+
+<!--%%==========================================================================
+html.class.attr.mode
+Output additional values for an HTML #{class} attribute.
+:Revision:version="3.10" date="2013-07-10" status="final"
+
+This mode is called by *{html.class.attr} on a source element. This mode is
+intended for extensions to have an easy way to add additional HTML class values
+for styling.
+
+Note that these stylesheets use CSS classes extensively for styling and for
+certain JavaScript functionality. Extensions should be careful to output class
+values that do not conflict with those used in these stylesheets.
+-->
+<xsl:template mode="html.class.attr.mode" match="*"/>
+
+
+<!--**==========================================================================
 html.css
 Output all CSS for an HTML output page.
 :Revision:version="1.0" date="2010-12-23" status="final"
diff --git a/xslt/dita/html/dita2html-block.xsl b/xslt/dita/html/dita2html-block.xsl
index ab77876..40aa20e 100644
--- a/xslt/dita/html/dita2html-block.xsl
+++ b/xslt/dita/html/dita2html-block.xsl
@@ -53,11 +53,10 @@ FIXME
     <xsl:call-template name="html.lang.attrs">
       <xsl:with-param name="node" select="$node"/>
     </xsl:call-template>
-    <xsl:if test="$class != ''">
-      <xsl:attribute name="class">
-        <xsl:value-of select="$class"/>
-      </xsl:attribute>
-    </xsl:if>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="node" select="$node"/>
+      <xsl:with-param name="class" select="$class"/>
+    </xsl:call-template>
     <div class="contents">
       <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
     </div>
@@ -85,11 +84,10 @@ FIXME
     <xsl:call-template name="html.lang.attrs">
       <xsl:with-param name="node" select="$node"/>
     </xsl:call-template>
-    <xsl:if test="$class != ''">
-      <xsl:attribute name="class">
-        <xsl:value-of select="$class"/>
-      </xsl:attribute>
-    </xsl:if>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="node" select="$node"/>
+      <xsl:with-param name="class" select="$class"/>
+    </xsl:call-template>
     <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
   </p>
 </xsl:template>
@@ -115,11 +113,10 @@ FIXME
     <xsl:call-template name="html.lang.attrs">
       <xsl:with-param name="node" select="$node"/>
     </xsl:call-template>
-    <xsl:if test="$class != ''">
-      <xsl:attribute name="class">
-        <xsl:value-of select="$class"/>
-      </xsl:attribute>
-    </xsl:if>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="node" select="$node"/>
+      <xsl:with-param name="class" select="$class"/>
+    </xsl:call-template>
     <pre class="contents">
       <!-- Strip off a leading newline -->
       <xsl:if test="$children[1]/self::text()">
@@ -196,8 +193,11 @@ FIXME
       </xsl:otherwise>
     </xsl:choose>
   </xsl:variable>
-  <div class="{$style}">
+  <div>
     <xsl:call-template name="dita.id"/>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="$style"/>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <div class="inner">
       <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/&topic_title_all;"/>
@@ -250,13 +250,15 @@ FIXME
   <div>
     <xsl:call-template name="dita.id"/>
     <xsl:call-template name="html.lang.attrs"/>
-    <xsl:attribute name="class">
-      <xsl:text>note</xsl:text>
-      <xsl:if test="$notetype != ''">
-        <xsl:text> note-</xsl:text>
-        <xsl:value-of select="$notetype"/>
-      </xsl:if>
-    </xsl:attribute>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class">
+        <xsl:text>note</xsl:text>
+        <xsl:if test="$notetype != ''">
+          <xsl:text> note-</xsl:text>
+          <xsl:value-of select="$notetype"/>
+        </xsl:if>
+      </xsl:with-param>
+    </xsl:call-template>
     <div class="inner">
       <div class="region">
         <div class="contents">
@@ -315,9 +317,12 @@ FIXME
 <!-- = section = -->
 <xsl:template mode="dita2html.topic.mode" match="&topic_section;">
   <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
-  <div class="section">
+  <div>
     <xsl:call-template name="dita.id"/>
     <xsl:call-template name="html.lang.attrs"/>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'section'"/>
+    </xsl:call-template>
     <!-- A DITA section may have an optional title. But it can be anywhere
          in the child node list. And there could be more than one, but all
          but the first are ignored. Apparently. Spec isn't very clear, but
@@ -369,9 +374,12 @@ FIXME
       </xsl:otherwise>
     </xsl:choose>
   </xsl:variable>
-  <div class="title">
+  <div>
     <xsl:call-template name="dita.id"/>
     <xsl:call-template name="html.lang.attrs"/>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'title'"/>
+    </xsl:call-template>
     <xsl:element name="{concat('h', $depth_)}" namespace="{$html.namespace}">
       <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
     </xsl:element>
diff --git a/xslt/dita/html/dita2html-inline.xsl b/xslt/dita/html/dita2html-inline.xsl
index c95fc5d..697b4d6 100644
--- a/xslt/dita/html/dita2html-inline.xsl
+++ b/xslt/dita/html/dita2html-inline.xsl
@@ -50,13 +50,17 @@ FIXME
 <xsl:template name="dita2html.span">
   <xsl:param name="node" select="."/>
   <xsl:param name="class" select="local-name($node)"/>
-  <span class="{$class}">
+  <span>
     <xsl:call-template name="dita.id">
       <xsl:with-param name="node" select="$node"/>
     </xsl:call-template>
     <xsl:call-template name="html.lang.attrs">
       <xsl:with-param name="node" select="$node"/>
     </xsl:call-template>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="node" select="$node"/>
+      <xsl:with-param name="class" select="$class"/>
+    </xsl:call-template>
     <xsl:apply-templates mode="dita2html.inline.content.mode" select="$node"/>
   </span>
 </xsl:template>
@@ -196,6 +200,8 @@ FIXME
 <xsl:template mode="dita2html.topic.mode" match="&topic_xref;">
   <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
   <a>
+    <xsl:call-template name="html.class.attr"/>
+    <xsl:call-template name="html.lang.attrs"/>
     <xsl:attribute name="href">
       <xsl:call-template name="dita.ref.href.target">
         <xsl:with-param name="node" select="."/>
diff --git a/xslt/dita/html/dita2html-list.xsl b/xslt/dita/html/dita2html-list.xsl
index 1f0bd59..0d651ac 100644
--- a/xslt/dita/html/dita2html-list.xsl
+++ b/xslt/dita/html/dita2html-list.xsl
@@ -38,9 +38,12 @@ REMARK: Describe this module
 <!-- = choice = -->
 <xsl:template mode="dita2html.topic.mode" match="&topic_choice;">
   <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
-  <li class="list">
+  <li>
     <xsl:call-template name="dita.id"/>
     <xsl:call-template name="html.lang.attrs"/>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'list'"/>
+    </xsl:call-template>
     <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
   </li>
 </xsl:template>
@@ -48,9 +51,12 @@ REMARK: Describe this module
 <!-- = choices = -->
 <xsl:template mode="dita2html.topic.mode" match="&topic_choices;">
   <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
-  <div class="list">
+  <div>
     <xsl:call-template name="dita.id"/>
     <xsl:call-template name="html.lang.attrs"/>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'list'"/>
+    </xsl:call-template>
     <div class="inner">
       <ul class="list">
         <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
@@ -62,9 +68,12 @@ REMARK: Describe this module
 <!-- = dd = -->
 <xsl:template mode="dita2html.topic.mode" match="&topic_dd;">
   <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
-  <dd class="terms">
+  <dd>
     <xsl:call-template name="dita.id"/>
     <xsl:call-template name="html.lang.attrs"/>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'terms'"/>
+    </xsl:call-template>
     <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
   </dd>
 </xsl:template>
@@ -72,9 +81,12 @@ REMARK: Describe this module
 <!-- = ddhd = -->
 <xsl:template mode="dita2html.topic.mode" match="&topic_ddhd;">
   <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
-  <dd class="terms ddhd">
+  <dd>
     <xsl:call-template name="dita.id"/>
     <xsl:call-template name="html.lang.attrs"/>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'terms ddhd'"/>
+    </xsl:call-template>
     <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
   </dd>
 </xsl:template>
@@ -89,9 +101,12 @@ REMARK: Describe this module
       <xsl:with-param name="conref" select="$conref"/>
     </xsl:call-template>
   </xsl:variable>
-  <div class="terms">
+  <div>
     <xsl:call-template name="dita.id"/>
     <xsl:call-template name="html.lang.attrs"/>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'terms'"/>
+    </xsl:call-template>
     <dl>
       <xsl:attribute name="class">
         <xsl:text>terms</xsl:text>
@@ -119,9 +134,12 @@ REMARK: Describe this module
 <!-- = dt = -->
 <xsl:template mode="dita2html.topic.mode" match="&topic_dt;">
   <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
-  <dt class="terms">
+  <dt>
     <xsl:call-template name="dita.id"/>
     <xsl:call-template name="html.lang.attrs"/>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'terms'"/>
+    </xsl:call-template>
     <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
   </dt>
 </xsl:template>
@@ -129,9 +147,12 @@ REMARK: Describe this module
 <!-- = dthd = -->
 <xsl:template mode="dita2html.topic.mode" match="&topic_dthd;">
   <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
-  <dt class="terms dthd">
+  <dt>
     <xsl:call-template name="dita.id"/>
     <xsl:call-template name="html.lang.attrs"/>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'terms dthd'"/>
+    </xsl:call-template>
     <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
   </dt>
 </xsl:template>
@@ -139,9 +160,12 @@ REMARK: Describe this module
 <!-- = li = -->
 <xsl:template mode="dita2html.topic.mode" match="&topic_li;">
   <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
-  <li class="list">
+  <li>
     <xsl:call-template name="dita.id"/>
     <xsl:call-template name="html.lang.attrs"/>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'list'"/>
+    </xsl:call-template>
     <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
   </li>
 </xsl:template>
@@ -156,9 +180,12 @@ REMARK: Describe this module
       <xsl:with-param name="conref" select="$conref"/>
     </xsl:call-template>
   </xsl:variable>
-  <div class="list">
+  <div>
     <xsl:call-template name="dita.id"/>
     <xsl:call-template name="html.lang.attrs"/>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'list'"/>
+    </xsl:call-template>
     <div class="inner">
       <ol>
         <xsl:attribute name="class">
@@ -183,9 +210,12 @@ REMARK: Describe this module
       <xsl:with-param name="conref" select="$conref"/>
     </xsl:call-template>
   </xsl:variable>
-  <div class="list">
+  <div>
     <xsl:call-template name="dita.id"/>
     <xsl:call-template name="html.lang.attrs"/>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'list'"/>
+    </xsl:call-template>
     <div class="inner">
       <ul>
         <xsl:attribute name="class">
@@ -209,9 +239,12 @@ REMARK: Describe this module
 <!-- = sli = -->
 <xsl:template mode="dita2html.topic.mode" match="&topic_sli;">
   <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
-  <li class="list">
+  <li>
     <xsl:call-template name="dita.id"/>
     <xsl:call-template name="html.lang.attrs"/>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'list'"/>
+    </xsl:call-template>
     <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
   </li>
 </xsl:template>
@@ -220,9 +253,12 @@ REMARK: Describe this module
 <xsl:template mode="dita2html.topic.mode" match="&topic_step;">
   <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
   <xsl:variable name="pre" select="preceding-sibling::&topic_step;"/>
-  <li class="steps" value="{count($pre) + 1}">
+  <li value="{count($pre) + 1}">
     <xsl:call-template name="dita.id"/>
     <xsl:call-template name="html.lang.attrs"/>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'steps'"/>
+    </xsl:call-template>
     <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
   </li>
 </xsl:template>
@@ -230,9 +266,12 @@ REMARK: Describe this module
 <!-- = steps = -->
 <xsl:template mode="dita2html.topic.mode" match="&topic_steps;">
   <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
-  <div class="steps">
+  <div>
     <xsl:call-template name="dita.id"/>
     <xsl:call-template name="html.lang.attrs"/>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'steps'"/>
+    </xsl:call-template>
     <div class="inner">
       <div class="region">
         <ol class="steps">
@@ -246,9 +285,12 @@ REMARK: Describe this module
 <!-- = steps-unordered = -->
 <xsl:template mode="dita2html.topic.mode" match="&topic_steps-unordered;">
   <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
-  <div class="steps">
+  <div>
     <xsl:call-template name="dita.id"/>
     <xsl:call-template name="html.lang.attrs"/>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'steps'"/>
+    </xsl:call-template>
     <div class="inner">
       <div class="region">
         <ul class="steps">
@@ -262,9 +304,12 @@ REMARK: Describe this module
 <!-- = stepsection = -->
 <xsl:template mode="dita2html.topic.mode" match="&topic_stepsection;">
   <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
-  <li class="stepsection">
+  <li>
     <xsl:call-template name="dita.id"/>
     <xsl:call-template name="html.lang.attrs"/>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'stepsection'"/>
+    </xsl:call-template>
     <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
   </li>
 </xsl:template>
@@ -272,9 +317,12 @@ REMARK: Describe this module
 <!-- = substep = -->
 <xsl:template mode="dita2html.topic.mode" match="&topic_substep;">
   <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
-  <li class="steps substeps">
+  <li>
     <xsl:call-template name="dita.id"/>
     <xsl:call-template name="html.lang.attrs"/>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'steps substeps'"/>
+    </xsl:call-template>
     <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
   </li>
 </xsl:template>
@@ -282,9 +330,12 @@ REMARK: Describe this module
 <!-- = substeps = -->
 <xsl:template mode="dita2html.topic.mode" match="&topic_substeps;">
   <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
-  <div class="substeps">
+  <div>
     <xsl:call-template name="dita.id"/>
     <xsl:call-template name="html.lang.attrs"/>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'substeps'"/>
+    </xsl:call-template>
     <ol class="substeps">
       <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
     </ol>
@@ -301,9 +352,12 @@ REMARK: Describe this module
       <xsl:with-param name="conref" select="$conref"/>
     </xsl:call-template>
   </xsl:variable>
-  <div class="list">
+  <div>
     <xsl:call-template name="dita.id"/>
     <xsl:call-template name="html.lang.attrs"/>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'list'"/>
+    </xsl:call-template>
     <div class="inner">
       <ul>
         <xsl:attribute name="class">
diff --git a/xslt/dita/html/dita2html-media.xsl b/xslt/dita/html/dita2html-media.xsl
index 3ae2726..f0b316b 100644
--- a/xslt/dita/html/dita2html-media.xsl
+++ b/xslt/dita/html/dita2html-media.xsl
@@ -46,7 +46,11 @@ REMARK: Describe this module
   </xsl:variable>
   <xsl:choose>
     <xsl:when test="$placement = 'break'">
-      <div class="media media-image">
+      <div>
+        <xsl:call-template name="html.lang.attrs"/>
+        <xsl:call-template name="html.class.attr">
+          <xsl:with-param name="class" select="'media media-image'"/>
+        </xsl:call-template>
         <div class="inner">
           <xsl:call-template name="_dita2html.image.img">
             <xsl:with-param name="conref" select="$conref"/>
@@ -56,7 +60,11 @@ REMARK: Describe this module
       </div>
     </xsl:when>
     <xsl:otherwise>
-      <span class="media media-image">
+      <span>
+        <xsl:call-template name="html.lang.attrs"/>
+        <xsl:call-template name="html.class.attr">
+          <xsl:with-param name="class" select="'media media-image'"/>
+        </xsl:call-template>
         <xsl:call-template name="_dita2html.image.img">
           <xsl:with-param name="conref" select="$conref"/>
           <xsl:with-param name="usemap" select="$usemap"/>
@@ -149,6 +157,8 @@ REMARK: Describe this module
     <xsl:with-param name="usemap" select="concat('#', $name)"/>
   </xsl:apply-templates>
   <map name="{$name}">
+    <xsl:call-template name="html.lang.attrs"/>
+    <xsl:call-template name="html.class.attr"/>
     <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/&topic_area;"/>
   </map>
 </xsl:template>
@@ -157,6 +167,8 @@ REMARK: Describe this module
 <xsl:template mode="dita2html.topic.mode" match="&topic_area;">
   <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
   <area>
+    <xsl:call-template name="html.lang.attrs"/>
+    <xsl:call-template name="html.class.attr"/>
     <xsl:attribute name="shape">
       <xsl:value-of select="$conref/&topic_shape;"/>
     </xsl:attribute>
@@ -176,14 +188,12 @@ REMARK: Describe this module
 
 <!-- = object = -->
 <xsl:template mode="dita2html.topic.mode" match="&topic_object;">
-  <xsl:variable name="node" select="."/>
   <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
-  <div class="dita-object">
-    <xsl:call-template name="dita.id">
-      <xsl:with-param name="node" select="$node"/>
-    </xsl:call-template>
-    <xsl:call-template name="html.lang.attrs">
-      <xsl:with-param name="node" select="$node"/>
+  <div>
+    <xsl:call-template name="dita.id"/>
+    <xsl:call-template name="html.lang.attrs"/>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'dita-object'"/>
     </xsl:call-template>
     <xsl:apply-templates mode="dita2html.topic.mode" select="&topic_desc;"/>
     <div class="contents">
@@ -192,7 +202,6 @@ REMARK: Describe this module
           <xsl:attribute name="{local-name(.)}">
             <xsl:call-template name="dita.ref.conref.attr">
               <xsl:with-param name="attr" select="local-name(.)"/>
-              <xsl:with-param name="node" select="$node"/>
               <xsl:with-param name="conref" select="$conref"/>
             </xsl:call-template>
           </xsl:attribute>
@@ -205,15 +214,11 @@ REMARK: Describe this module
 
 <!-- = param = -->
 <xsl:template mode="dita2html.topic.mode" match="&topic_param;">
-  <xsl:variable name="node" select="."/>
   <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
-  <xsl:call-template name="dita.id">
-    <xsl:with-param name="node" select="$node"/>
-  </xsl:call-template>
-  <xsl:call-template name="html.lang.attrs">
-    <xsl:with-param name="node" select="$node"/>
-  </xsl:call-template>
   <xsl:element name="{local-name(.)}" namespace="{$html.namespace}">
+    <xsl:call-template name="dita.id"/>
+    <xsl:call-template name="html.lang.attrs"/>
+    <xsl:call-template name="html.class.attr"/>
     <xsl:for-each select="@*[namespace-uri(.) = '']">
       <xsl:attribute name="{local-name(.)}">
         <xsl:call-template name="dita.ref.conref.attr">
diff --git a/xslt/dita/html/dita2html-table.xsl b/xslt/dita/html/dita2html-table.xsl
index 996a5fa..f960ba3 100644
--- a/xslt/dita/html/dita2html-table.xsl
+++ b/xslt/dita/html/dita2html-table.xsl
@@ -37,9 +37,12 @@ REMARK: Describe this module
 <xsl:template mode="dita2html.topic.mode" match="&topic_simpletable;">
   <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
   <xsl:variable name="keycol" select="@keycol"/>
-  <div class="table">
+  <div>
     <xsl:call-template name="dita.id"/>
     <xsl:call-template name="html.lang.attrs"/>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'table'"/>
+    </xsl:call-template>
     <table class="table">
       <xsl:for-each select="$conref/&topic_sthead;[1]">
         <thead>
@@ -70,6 +73,9 @@ REMARK: Describe this module
     <xsl:call-template name="html.lang.attrs">
       <xsl:with-param name="node" select="$node"/>
     </xsl:call-template>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="node" select="$node"/>
+    </xsl:call-template>
     <xsl:for-each select="$conref/&topic_stentry;">
       <xsl:choose>
         <xsl:when test="position() = $keycol or $node[self::&topic_sthead;]">
diff --git a/xslt/dita/html/dita2html-topic.xsl b/xslt/dita/html/dita2html-topic.xsl
index f2ee1df..3bf35b6 100644
--- a/xslt/dita/html/dita2html-topic.xsl
+++ b/xslt/dita/html/dita2html-topic.xsl
@@ -510,9 +510,12 @@ div.dita-object > div.desc {
   <xsl:param name="topicref" select="/false"/>
   <xsl:choose>
     <xsl:when test="parent::&topic_topic_all;">
-      <div class="sect">
+      <div>
         <xsl:call-template name="dita.id"/>
         <xsl:call-template name="html.lang.attrs"/>
+        <xsl:call-template name="html.class.attr">
+          <xsl:with-param name="class" select="'sect'"/>
+        </xsl:call-template>
         <div class="inner">
           <xsl:call-template name="_dita2html.topic.inner"/>
         </div>
@@ -562,9 +565,12 @@ div.dita-object > div.desc {
   <xsl:param name="topicref" select="/false"/>
   <xsl:variable name="node" select="."/>
   <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
-  <div class="region">
+  <div>
     <xsl:call-template name="dita.id"/>
     <xsl:call-template name="html.lang.attrs"/>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'region'"/>
+    </xsl:call-template>
     <div class="contents">
       <xsl:apply-templates mode="dita2html.topic.mode" select="../&topic_shortdesc;"/>
       <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
@@ -576,7 +582,11 @@ div.dita-object > div.desc {
 </xsl:template>
 
 <xsl:template mode="dita2html.topic.mode" match="&topic_related-links;">
-  <div class="sect sect-links" role="navigation">
+  <div role="navigation">
+    <xsl:call-template name="html.lang.attrs"/>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'sect sect-links'"/>
+    </xsl:call-template>
     <div class="hgroup"/>
     <div class="contents">
       <div class="links">
@@ -596,9 +606,12 @@ div.dita-object > div.desc {
 
 <xsl:template mode="dita2html.topic.mode" match="&topic_link;">
   <!-- FIXME -->
-  <li class="links">
+  <li>
     <xsl:call-template name="dita.id"/>
     <xsl:call-template name="html.lang.attrs"/>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'links'"/>
+    </xsl:call-template>
     <a>
       <xsl:attribute name="href">
         <!-- FIXME -->
@@ -632,9 +645,12 @@ div.dita-object > div.desc {
 </xsl:template>
 
 <xsl:template mode="dita2html.topic.mode" match="&topic_linkinfo;">
-  <li class="links links-linkinfo">
+  <li>
     <xsl:call-template name="dita.id"/>
     <xsl:call-template name="html.lang.attrs"/>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'links links-linkinfo'"/>
+    </xsl:call-template>
     <xsl:apply-templates modes="dita2html.topic.mode"/>
   </li>
 </xsl:template>
@@ -643,9 +659,12 @@ div.dita-object > div.desc {
   <xsl:choose>
     <xsl:when test="&topic_title_all; or &topic_desc; or &topic_linkinfo;">
       <li class="links">
-        <div class="links">
+        <div>
           <xsl:call-template name="dita.id"/>
           <xsl:call-template name="html.lang.attrs"/>
+          <xsl:call-template name="html.class.attr">
+            <xsl:with-param name="class" select="'links'"/>
+          </xsl:call-template>
           <div class="inner">
             <xsl:apply-templates mode="dita2html.topic.mode" select="&topic_title_all;"/>
             <div class="region">
diff --git a/xslt/docbook/html/db2html-bibliography.xsl b/xslt/docbook/html/db2html-bibliography.xsl
index 0b4798b..d8cb0f0 100644
--- a/xslt/docbook/html/db2html-bibliography.xsl
+++ b/xslt/docbook/html/db2html-bibliography.xsl
@@ -169,7 +169,10 @@ This mode is used when processing the child elements of a #{biblioentry} or a
 inside a bibliography entry.
 -->
 <xsl:template mode="db2html.biblioentry.mode" match="*">
-  <span class="{local-name(.)}">
+  <span>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="local-name(.)"/>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:call-template name="db2html.anchor"/>
     <xsl:apply-templates mode="db2html.biblioentry.mode"/>
@@ -332,7 +335,10 @@ inside a bibliography entry.
 
 <!-- = biblioentry = -->
 <xsl:template match="biblioentry | db:biblioentry">
-  <div class="biblioentry">
+  <div>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'biblioentry'"/>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:call-template name="db2html.anchor"/>
     <xsl:call-template name="db2html.biblioentry.label"/>
@@ -343,7 +349,10 @@ inside a bibliography entry.
 <!-- = bibliomixed = -->
 <xsl:template match="bibliomixed | db:bibliomixed">
   <xsl:variable name="node" select="."/>
-  <div class="bibliomixed">
+  <div>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'biblimixed'"/>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:call-template name="db2html.anchor"/>
     <xsl:call-template name="db2html.biblioentry.label"/>
diff --git a/xslt/docbook/html/db2html-block.xsl b/xslt/docbook/html/db2html-block.xsl
index 2e1ed2c..34155a9 100644
--- a/xslt/docbook/html/db2html-block.xsl
+++ b/xslt/docbook/html/db2html-block.xsl
@@ -37,17 +37,22 @@ complex block-level elements.
 <!--**==========================================================================
 db2html.block
 Output an HTML #{div} element for a block-level element.
-:Revision:version="3.4" date="2011-11-12" status="final"
+:Revision:version="3.10" date="2011-07-11" status="final"
 $node: The block-level element to render.
 $class: The value of the HTML #{class} attribute.
 
 This template creates an HTML #{div} element for the given DocBook element.
+It passes the ${class} parameter to *{html.class.attr}.
 If the ${class} parameter is not provided, it uses the local name of ${node}.
 -->
 <xsl:template name="db2html.block">
   <xsl:param name="node" select="."/>
   <xsl:param name="class" select="local-name($node)"/>
-  <div class="{$class}">
+  <div>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="node" select="$node"/>
+      <xsl:with-param name="class" select="$class"/>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs">
       <xsl:with-param name="node" select="$node"/>
     </xsl:call-template>
@@ -62,7 +67,7 @@ If the ${class} parameter is not provided, it uses the local name of ${node}.
 <!--**==========================================================================
 db2html.block.formal
 Output HTML for a block-level element with an optional title and caption.
-:Revision:version="3.4" date="2011-11-12" status="final"
+:Revision:version="3.10" date="2011-07-11" status="final"
 $node: The block-level element to render.
 $class: The value of the HTML #{class} attribute.
 $title: An element to use for the title.
@@ -70,7 +75,8 @@ $caption: An element to use for the caption.
 $titleattr: An optional value for the HTML #{title} attribute.
 
 This template outputs HTML for a formal DocBook element, one that can have
-a title or caption. If the ${class} parameter is not provided, it uses the
+a title or caption. It passes the ${class} parameter to *{html.class.attr}.
+If the ${class} parameter is not provided, it uses the
 local name of ${node}. Even if ${title} and ${caption} are both empty, this
 template still outputs the extra wrapper elements for formal elements. If
 ${titleattr} is provided, it is used for the value of the HTML #{title}
@@ -84,7 +90,11 @@ attribute on the outermost #{div} element.
   <xsl:param name="caption" select="$node/caption | $node/db:caption"/>
   <xsl:param name="titleattr" select="''"/>
 
-  <div class="{$class}">
+  <div>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="node" select="$node"/>
+      <xsl:with-param name="class" select="$class"/>
+    </xsl:call-template>
     <xsl:if test="$titleattr != ''">
       <xsl:attribute name="title">
         <xsl:value-of select="$titleattr"/>
@@ -156,7 +166,11 @@ element.  It is called by *{db2html.block.formal}.
       </xsl:otherwise>
     </xsl:choose>
   </xsl:variable>
-  <div class="title">
+  <div>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="node" select="$title"/>
+      <xsl:with-param name="class" select="'title'"/>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs">
       <xsl:with-param name="node" select="$title"/>
     </xsl:call-template>
@@ -175,7 +189,7 @@ element.  It is called by *{db2html.block.formal}.
 <!--**==========================================================================
 db2html.blockquote
 Output an HTML #{blockquote} element.
-:Revision:version="3.4" date="2011-11-12" status="final"
+:Revision:version="3.10" date="2011-07-11" status="final"
 $node: The DocBook element ot render as a quote.
 
 This template creates an HTML #{blockquote} element for the given DocBook
@@ -184,10 +198,13 @@ element. It's used for the DocBook #{blockquote} and #{epigraph} elements.
 <xsl:template name="db2html.blockquote">
   <xsl:param name="node" select="."/>
   <div>
-    <xsl:attribute name="class">
-      <xsl:text>quote </xsl:text>
-      <xsl:value-of select="local-name($node)"/>
-    </xsl:attribute>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="node" select="$node"/>
+      <xsl:with-param name="class">
+        <xsl:text>quote </xsl:text>
+        <xsl:value-of select="local-name($node)"/>
+      </xsl:with-param>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs">
       <xsl:with-param name="node" select="$node"/>
     </xsl:call-template>
@@ -212,17 +229,22 @@ element. It's used for the DocBook #{blockquote} and #{epigraph} elements.
 <!--**==========================================================================
 db2html.para
 Output an HTML #{p} element for a block-level element.
-:Revision:version="3.4" date="2011-11-12" status="final"
+:Revision:version="3.10" date="2011-07-11" status="final"
 $node: The block-level element to render.
 $class: The value of the HTML #{class} attribute.
 
 This template creates an HTML #{p} element for the given DocBook element.
+It passes the ${class} parameter to *{html.class.attr}.
 If the ${class} parameter is not provided, it uses the local name of ${node}.
 -->
 <xsl:template name="db2html.para">
   <xsl:param name="node" select="."/>
   <xsl:param name="class" select="local-name($node)"/>
-  <p class="{$class}">
+  <p>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="node" select="$node"/>
+      <xsl:with-param name="class" select="$class"/>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs">
       <xsl:with-param name="node" select="$node"/>
     </xsl:call-template>
@@ -237,12 +259,13 @@ If the ${class} parameter is not provided, it uses the local name of ${node}.
 <!--**==========================================================================
 db2html.pre
 Output an HTML #{pre} element for a block-level element.
-:Revision:version="3.4" date="2011-11-12" status="final"
+:Revision:version="3.10" date="2011-07-11" status="final"
 $node: The block-level element to render.
 $class: The value of the HTML #{class} attribute.
 $children: The child elements to process.
 
 This template creates an HTML #{pre} element for the given DocBook element.
+It passes the ${class} parameter to *{html.class.attr}.
 If the ${class} parameter is not provided, it uses the local name of ${node}.
 
 If ${node} has the #{linenumbering} attribute set to #{"numbered"}, then this
@@ -259,7 +282,11 @@ syntax highlighting support based on the #{language} attribute of ${node}.
   <xsl:param name="node" select="."/>
   <xsl:param name="class" select="local-name($node)"/>
   <xsl:param name="children" select="$node/node()"/>
-  <div class="{$class}">
+  <div>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="node" select="$node"/>
+      <xsl:with-param name="class" select="$class"/>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs">
       <xsl:with-param name="node" select="$node"/>
     </xsl:call-template>
@@ -421,7 +448,10 @@ syntax highlighting support based on the #{language} attribute of ${node}.
       </xsl:otherwise>
     </xsl:choose>
   </xsl:variable>
-  <div class="hgroup bridgehead">
+  <div>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'hgroup bridgehead'"/>
+    </xsl:call-template>
     <xsl:element name="{$title_h}" namespace="{$html.namespace}">
       <xsl:apply-templates/>
     </xsl:element>
diff --git a/xslt/docbook/html/db2html-callout.xsl b/xslt/docbook/html/db2html-callout.xsl
index 401757a..160438b 100644
--- a/xslt/docbook/html/db2html-callout.xsl
+++ b/xslt/docbook/html/db2html-callout.xsl
@@ -68,7 +68,10 @@ element, locate the corresponding #{co} element and call this template on it.
 <!-- = callout == -->
 <xsl:template match="callout | db:callout">
   <xsl:variable name="node" select="."/>
-  <div class="callout">
+  <div>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'callout'"/>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:call-template name="db2html.anchor"/>
     <div class="co">
diff --git a/xslt/docbook/html/db2html-classsynopsis.xsl b/xslt/docbook/html/db2html-classsynopsis.xsl
index e551bb2..b9d9a0d 100644
--- a/xslt/docbook/html/db2html-classsynopsis.xsl
+++ b/xslt/docbook/html/db2html-classsynopsis.xsl
@@ -80,10 +80,12 @@ at the root of a DocBook document.
   </xsl:variable>
   <div>
     <xsl:call-template name="html.lang.attrs"/>
-    <xsl:attribute name="class">
-      <xsl:text>synopsis </xsl:text>
-      <xsl:value-of select="local-name(.)"/>
-    </xsl:attribute>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class">
+        <xsl:text>synopsis </xsl:text>
+        <xsl:value-of select="local-name(.)"/>
+      </xsl:with-param>
+    </xsl:call-template>
     <xsl:call-template name="db2html.anchor"/>
     <pre class="contents {local-name(.)} classsynopsis-{$language}">
       <xsl:choose>
@@ -114,7 +116,10 @@ at the root of a DocBook document.
 
 <!-- = methodparam = -->
 <xsl:template match="methodparam | db:methodparam">
-  <span class="methodparam">
+  <span>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'methodparam'"/>
+    </xsl:call-template>
     <xsl:for-each select="*">
       <xsl:if test="position() != 1">
         <xsl:text> </xsl:text>
@@ -328,7 +333,10 @@ methods is expected to mark the visibility, such as #{public} or #{private}.
 <!-- = methodparam % db2html.class.cpp.mode = -->
 <xsl:template mode="db2html.class.cpp.mode"
               match="methodparam | db:methodparam">
-  <span class="methodparam">
+  <span>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'methodparam'"/>
+    </xsl:call-template>
     <xsl:for-each select="*">
       <xsl:if test="position() != 1">
         <xsl:text> </xsl:text>
diff --git a/xslt/docbook/html/db2html-cmdsynopsis.xsl b/xslt/docbook/html/db2html-cmdsynopsis.xsl
index a4fcb14..462738c 100644
--- a/xslt/docbook/html/db2html-cmdsynopsis.xsl
+++ b/xslt/docbook/html/db2html-cmdsynopsis.xsl
@@ -82,7 +82,10 @@ This module contains templates to process DocBook command synopsis elements.
         <xsl:text>[</xsl:text>
       </xsl:otherwise>
     </xsl:choose>
-    <span class="arg">
+    <span>
+      <xsl:call-template name="html.class.attr">
+        <xsl:with-param name="class" select="'arg'"/>
+      </xsl:call-template>
       <xsl:for-each select="node()">
         <xsl:choose>
           <xsl:when test="self::sbr or self::db:sbr">
@@ -130,9 +133,9 @@ This module contains templates to process DocBook command synopsis elements.
     </xsl:choose>
   </xsl:param>
   <div>
-    <xsl:attribute name="class">
-      <xsl:text>synopsis cmdsynopsis</xsl:text>
-    </xsl:attribute>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'synopsis cmdsynopsis'"/>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:call-template name="db2html.anchor"/>
     <pre class="contents cmdsynopsis">
@@ -224,7 +227,10 @@ This module contains templates to process DocBook command synopsis elements.
         <xsl:text>[</xsl:text>
       </xsl:otherwise>
     </xsl:choose>
-    <span class="group">
+    <span>
+      <xsl:call-template name="html.class.attr">
+        <xsl:with-param name="class" select="'group'"/>
+      </xsl:call-template>
       <xsl:for-each select="*">
         <xsl:choose>
           <xsl:when test="self::sbr or self::db:sbr">
@@ -274,7 +280,10 @@ This module contains templates to process DocBook command synopsis elements.
       </xsl:otherwise>
     </xsl:choose>
   </xsl:param>
-  <div class="synopfragment">
+  <div>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'synopfragment'"/>
+    </xsl:call-template>
     <xsl:call-template name="db2html.anchor"/>
     <xsl:variable name="count" select="count(preceding-sibling::synopfragment) +
                                        count(preceding-sibling::db:synopfragment)"/>
diff --git a/xslt/docbook/html/db2html-division.xsl b/xslt/docbook/html/db2html-division.xsl
index f9cb1f4..f442e41 100644
--- a/xslt/docbook/html/db2html-division.xsl
+++ b/xslt/docbook/html/db2html-division.xsl
@@ -128,10 +128,13 @@ REMARK: Talk about some of the parameters
         <xsl:call-template name="html.lang.attrs">
           <xsl:with-param name="node" select="$node"/>
         </xsl:call-template>
-        <xsl:attribute name="class">
-          <xsl:value-of select="local-name($node)"/>
-          <xsl:text> sect</xsl:text>
-        </xsl:attribute>
+        <xsl:call-template name="html.class.attr">
+          <xsl:with-param name="node" select="$node"/>
+          <xsl:with-param name="class">
+            <xsl:value-of select="local-name($node)"/>
+            <xsl:text> sect</xsl:text>
+          </xsl:with-param>
+        </xsl:call-template>
         <xsl:if test="$node/@id">
           <xsl:attribute name="id">
             <xsl:value-of select="$node/@id"/>
diff --git a/xslt/docbook/html/db2html-ebnf.xsl b/xslt/docbook/html/db2html-ebnf.xsl
index c62cbb4..ce03ab1 100644
--- a/xslt/docbook/html/db2html-ebnf.xsl
+++ b/xslt/docbook/html/db2html-ebnf.xsl
@@ -47,7 +47,10 @@ REMARK: Describe this module
 
 <!-- = productionset = -->
 <xsl:template match="productionset | db:productionset">
-  <div class="productionset">
+  <div>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'productionset'"/>
+    </xsl:call-template>
     <xsl:call-template name="db2html.anchor"/>
     <xsl:apply-templates select="title | db:title | db:info/db:title"/>
     <table class="productionset">
diff --git a/xslt/docbook/html/db2html-footnote.xsl b/xslt/docbook/html/db2html-footnote.xsl
index e660bc7..9a151eb 100644
--- a/xslt/docbook/html/db2html-footnote.xsl
+++ b/xslt/docbook/html/db2html-footnote.xsl
@@ -116,7 +116,11 @@ This templates outputs the actual text of a footnote as a block-level element.
       </xsl:otherwise>
     </xsl:choose>
   </xsl:variable>
-  <div class="footnote" id="{$anchor}">
+  <div id="{$anchor}">
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="node" select="$node"/>
+      <xsl:with-param name="class" select="'footnote'"/>
+    </xsl:call-template>
     <a class="footnote" href="{$href}">
       <xsl:value-of select="count($node/preceding::footnote | $node/preceding::db:footnote) + 1"/>
     </a>
diff --git a/xslt/docbook/html/db2html-inline.xsl b/xslt/docbook/html/db2html-inline.xsl
index 6c87d9e..68dfe61 100644
--- a/xslt/docbook/html/db2html-inline.xsl
+++ b/xslt/docbook/html/db2html-inline.xsl
@@ -76,7 +76,11 @@ REMARK: Document this template
   <xsl:variable name="linkend" select="$node/@linkend"/>
 
   <!-- FIXME: do CSS classes, rather than inline styles -->
-  <span class="{$class} {$name-class}">
+  <span>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="node" select="$node"/>
+      <xsl:with-param name="class" select="concat($class, ' ', $name-class)"/>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs">
       <xsl:with-param name="node" select="$node"/>
     </xsl:call-template>
diff --git a/xslt/docbook/html/db2html-list.xsl b/xslt/docbook/html/db2html-list.xsl
index b7f6db0..8680564 100644
--- a/xslt/docbook/html/db2html-list.xsl
+++ b/xslt/docbook/html/db2html-list.xsl
@@ -35,7 +35,10 @@ REMARK: Describe this module
 
 <!-- = glosslist = -->
 <xsl:template match="glosslist | db:glosslist">
-  <div class="list glosslist">
+  <div>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'list glosslist'"/>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:call-template name="db2html.anchor"/>
     <xsl:apply-templates select="title | db:title | db:info/db:title"/>
@@ -47,7 +50,10 @@ REMARK: Describe this module
 
 <!-- = glossdef = -->
 <xsl:template match="glossdef | db:glossdef">
-  <dd class="glossdef">
+  <dd>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'glossdef'"/>
+    </xsl:call-template>
     <xsl:apply-templates select="*[not(self::glossseealso) and not(self::db:glossseealso)]"/>
   </dd>
   <xsl:apply-templates select="glossseealso[1] | db:glossseealso[1]"/>
@@ -56,9 +62,9 @@ REMARK: Describe this module
 <!-- = glossentry = -->
 <xsl:template match="glossentry | db:glossentry">
   <dt>
-    <xsl:attribute name="class">
-      <xsl:text>glossterm</xsl:text>
-    </xsl:attribute>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'glossterm'"/>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:call-template name="db2html.anchor"/>
     <xsl:apply-templates select="glossterm | db:glossterm"/>
@@ -73,7 +79,10 @@ REMARK: Describe this module
 
 <!-- = glosssee(also) = -->
 <xsl:template match="glosssee | glossseealso | db:glosssee | db:glossseealso">
-  <dd class="{local-name(.)}">
+  <dd>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="local-name(.)"/>
+    </xsl:call-template>
     <p>
       <xsl:call-template name="l10n.gettext">
         <xsl:with-param name="msgid" select="concat(local-name(.), '.format')"/>
@@ -129,7 +138,10 @@ REMARK: Describe this module
 
 <!-- = itemizedlist = -->
 <xsl:template match="itemizedlist | db:itemizedlist">
-  <div class="list itemizedlist">
+  <div>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'list itemizedlist'"/>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:call-template name="db2html.anchor"/>
     <xsl:apply-templates select="db:info/db:title"/>
@@ -158,7 +170,10 @@ REMARK: Describe this module
 
 <!-- = itemizedlist/listitem = -->
 <xsl:template match="itemizedlist/listitem | db:itemizedlist/db:listitem">
-  <li class="list itemizedlist">
+  <li>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'list itemizedlist'"/>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:if test="@override">
       <xsl:attribute name="style">
@@ -192,7 +207,10 @@ REMARK: Describe this module
     </xsl:choose>
   </xsl:variable>
   <!-- FIXME: auto-numeration for nested lists -->
-  <div class="list orderedlist">
+  <div>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'list orderedlist'"/>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:call-template name="db2html.anchor"/>
     <xsl:apply-templates select="db:info/db:title"/>
@@ -229,7 +247,10 @@ REMARK: Describe this module
 
 <!-- = orderedlist/listitem = -->
 <xsl:template match="orderedlist/listitem | db:orderedlist/db:listitem">
-  <li class="list orderedlist">
+  <li>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'list orderedlist'"/>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:if test="@override">
       <xsl:attribute name="value">
@@ -243,7 +264,10 @@ REMARK: Describe this module
 
 <!-- = procedure = -->
 <xsl:template match="procedure | db:procedure">
-  <div class="steps">
+  <div>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'steps'"/>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:call-template name="db2html.anchor"/>
     <div class="inner">
@@ -267,7 +291,10 @@ REMARK: Describe this module
 
 <!-- = answer = -->
 <xsl:template match="answer | db:answer">
-  <dd class="answer">
+  <dd>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'answer'"/>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:choose>
       <xsl:when test="label | db:label">
@@ -295,7 +322,10 @@ REMARK: Describe this module
 
 <!-- = question = -->
 <xsl:template match="question | db:question">
-  <dt class="question">
+  <dt>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'question'"/>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:choose>
       <xsl:when test="label | db:label">
@@ -321,7 +351,10 @@ REMARK: Describe this module
   <xsl:variable name="position"
                 select="count(preceding-sibling::seg) +
                         count(preceding-sibling::db:seg) + 1"/>
-  <p class="seg">
+  <p>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'seg'"/>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:apply-templates select="../../segtitle[position() = $position] |
                                  ../../db:segtitle[position() = $position]"/>
@@ -334,7 +367,10 @@ REMARK: Describe this module
   <xsl:param name="position"
               select="count(preceding-sibling::seglistitem) +
                       count(preceding-sibling::db:seglistitem) + 1"/>
-  <div class="seglistitem">
+  <div>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'seglistitem'"/>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <div>
       <xsl:attribute name="class">
@@ -355,7 +391,10 @@ REMARK: Describe this module
 <!-- FIXME: Implement tabular segmentedlists -->
 <!-- = segmentedlist = -->
 <xsl:template match="segmentedlist | db:segmentedlist">
-  <div class="list segmentedlist">
+  <div>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'list segmentedlist'"/>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:call-template name="db2html.anchor"/>
     <xsl:apply-templates select="title | db:title | db:info/db:title"/>
@@ -367,6 +406,7 @@ REMARK: Describe this module
 <xsl:template match="segtitle | db:segtitle">
   <!-- FIXME: no style tags -->
   <b>
+    <xsl:call-template name="html.class.attr"/>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:apply-templates/>
     <!-- FIXME: i18n -->
@@ -388,7 +428,10 @@ REMARK: Describe this module
   </xsl:variable>
   <xsl:choose>
     <xsl:when test="@type = 'inline'">
-      <span class="simplelist">
+      <span>
+        <xsl:call-template name="html.class.attr">
+          <xsl:with-param name="class" select="'simplelist'"/>
+        </xsl:call-template>
         <xsl:call-template name="html.lang.attrs"/>
         <xsl:call-template name="db2html.anchor"/>
         <xsl:for-each select="member | db:member">
@@ -402,7 +445,10 @@ REMARK: Describe this module
       </span>
     </xsl:when>
     <xsl:when test="@type = 'horiz'">
-      <div class="list simplelist">
+      <div>
+        <xsl:call-template name="html.class.attr">
+          <xsl:with-param name="class" select="'list simplelist'"/>
+        </xsl:call-template>
         <xsl:call-template name="html.lang.attrs"/>
         <xsl:call-template name="db2html.anchor"/>
         <table class="simplelist">
@@ -429,7 +475,10 @@ REMARK: Describe this module
       </div>
     </xsl:when>
     <xsl:otherwise>
-      <div class="list simplelist">
+      <div>
+        <xsl:call-template name="html.class.attr">
+          <xsl:with-param name="class" select="'list simplelist'"/>
+        </xsl:call-template>
         <xsl:call-template name="html.lang.attrs"/>
         <xsl:call-template name="db2html.anchor"/>
         <xsl:variable name="rows"
@@ -465,7 +514,10 @@ REMARK: Describe this module
 <!-- FIXME: Do something with @performance -->
 <!-- = step = -->
 <xsl:template match="step | db:step">
-  <li class="steps">
+  <li>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'steps'"/>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:apply-templates/>
   </li>
@@ -476,7 +528,10 @@ REMARK: Describe this module
 <xsl:template match="substeps | db:substeps">
   <xsl:variable name="depth" select="count(ancestor::substeps |
                                            ancestor::db:substeps)"/>
-  <div class="steps substeps">
+  <div>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'steps substeps'"/>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:call-template name="db2html.anchor"/>
     <ol class="steps substeps">
@@ -494,7 +549,10 @@ REMARK: Describe this module
 
 <!-- = term = -->
 <xsl:template match="term | db:term">
-  <dt class="terms">
+  <dt>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'terms'"/>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:if test="(../varlistentry/@id and not(preceding-sibling::term)) or
                   (../db:varlistentry/@xml:id and not(preceding-sibling::db:term))">
@@ -509,7 +567,10 @@ REMARK: Describe this module
 
 <!-- = variablelist = -->
 <xsl:template match="variablelist | db:variablelist">
-  <div class="terms variablelist">
+  <div>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'terms variablelist'"/>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:call-template name="db2html.anchor"/>
     <xsl:apply-templates select="db:info/db:title"/>
@@ -529,7 +590,10 @@ REMARK: Describe this module
 
 <!-- = varlistentry/listitem = -->
 <xsl:template match="varlistentry/listitem | db:varlistentry/db:listitem">
-  <dd class="terms">
+  <dd>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'terms'"/>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:call-template name="db2html.anchor"/>
     <xsl:apply-templates/>
diff --git a/xslt/docbook/html/db2html-math.xsl b/xslt/docbook/html/db2html-math.xsl
index 6326cfd..2248a01 100644
--- a/xslt/docbook/html/db2html-math.xsl
+++ b/xslt/docbook/html/db2html-math.xsl
@@ -47,7 +47,11 @@ then outputs MathML content. It sets the #{display} attribute on the output to
 -->
 <xsl:template name="db2html.math.div">
   <xsl:param name="node" select="."/>
-  <div class="math">
+  <div>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="node" select="$node"/>
+      <xsl:with-param name="class" select="'math'"/>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs">
       <xsl:with-param name="node" select="$node"/>
     </xsl:call-template>
diff --git a/xslt/docbook/html/db2html-media.xsl b/xslt/docbook/html/db2html-media.xsl
index 648ef02..57bb29d 100644
--- a/xslt/docbook/html/db2html-media.xsl
+++ b/xslt/docbook/html/db2html-media.xsl
@@ -284,7 +284,10 @@ normal block content.
 <!-- = audiodata = -->
 <xsl:template match="mediaobject/audioobject/audiodata |
                      db:mediaobject/db:audioobject/db:audiodata">
-  <div class="media media-audio">
+  <div>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'media media-audio'"/>
+    </xsl:call-template>
     <div class="inner">
       <xsl:call-template name="db2html.audiodata">
         <xsl:with-param name="inline" select="false()"/>
@@ -294,7 +297,10 @@ normal block content.
 </xsl:template>
 <xsl:template match="inlinemediaobject/audioobject/audiodata |
                      db:inlinemediaobject/db:audioobject/db:audiodata">
-  <span class="media media-audio">
+  <span>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'media media-audio'"/>
+    </xsl:call-template>
     <xsl:call-template name="db2html.audiodata"/>
   </span>
 </xsl:template>
@@ -306,7 +312,10 @@ normal block content.
 
 <!-- = graphic = -->
 <xsl:template match="graphic">
-  <div class="graphic">
+  <div>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'graphic'"/>
+    </xsl:call-template>
     <xsl:call-template name="db2html.anchor"/>
     <xsl:call-template name="db2html.imagedata"/>
   </div>
@@ -331,7 +340,10 @@ normal block content.
 
 <!-- = inlinegraphic = -->
 <xsl:template match="inlinegraphic">
-  <span class="inlinegraphic">
+  <span>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'inlinegraphic'"/>
+    </xsl:call-template>
     <xsl:call-template name="db2html.anchor"/>
     <xsl:call-template name="db2html.imagedata"/>
   </span>
@@ -339,7 +351,10 @@ normal block content.
 
 <!-- = inlinemediaobject = -->
 <xsl:template match="inlinemediaobject | db:inlinemediaobject">
-  <span class="inlinemediaobject">
+  <span>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'inlinemediaobject'"/>
+    </xsl:call-template>
     <xsl:call-template name="db2html.anchor"/>
     <xsl:call-template name="db2html.mediaobject"/>
   </span>
@@ -347,7 +362,10 @@ normal block content.
 
 <!-- = mediaojbect = -->
 <xsl:template match="mediaobject | db:mediaobject">
-  <div class="mediaobject">
+  <div>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'mediaobject'"/>
+    </xsl:call-template>
     <xsl:call-template name="db2html.anchor"/>
     <xsl:call-template name="db2html.mediaobject"/>
     <!-- When a figure contains only a single mediaobject, it eats the caption -->
@@ -365,7 +383,10 @@ normal block content.
 <!-- = videodata = -->
 <xsl:template match="mediaobject/videoobject/videodata |
                      db:mediaobject/db:videoobject/db:videodata">
-  <div class="media media-video">
+  <div>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'media media-video'"/>
+    </xsl:call-template>
     <div class="inner">
       <xsl:call-template name="db2html.videodata">
         <xsl:with-param name="inline" select="false()"/>
@@ -375,7 +396,10 @@ normal block content.
 </xsl:template>
 <xsl:template match="inlinemediaobject/videoobject/videodata |
                      db:inlinemediaobject/db:videoobject/db:videodata">
-  <span class="media media-video">
+  <span>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'media media-video'"/>
+    </xsl:call-template>
     <xsl:call-template name="db2html.videodata"/>
   </span>
 </xsl:template>
diff --git a/xslt/docbook/html/db2html-refentry.xsl b/xslt/docbook/html/db2html-refentry.xsl
index d7f80f3..1f1c0e8 100644
--- a/xslt/docbook/html/db2html-refentry.xsl
+++ b/xslt/docbook/html/db2html-refentry.xsl
@@ -102,7 +102,10 @@ REMARK: Describe this module. Talk about refenty and friends
   <xsl:param name="depth_of_chunk">
     <xsl:call-template name="db.chunk.depth-of-chunk"/>
   </xsl:param>
-  <div class="refnamediv">
+  <div>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'refnamediv'"/>
+    </xsl:call-template>
     <xsl:call-template name="db2html.anchor"/>
     <xsl:choose>
       <xsl:when test="refdescriptor">
diff --git a/xslt/docbook/html/db2html-table.xsl b/xslt/docbook/html/db2html-table.xsl
index 6bc7bd4..cf8be87 100644
--- a/xslt/docbook/html/db2html-table.xsl
+++ b/xslt/docbook/html/db2html-table.xsl
@@ -50,12 +50,15 @@ FIXME
   <xsl:param name="rowsep" select="''"/>
   <xsl:param name="spanstr"/>
   <tr>
-    <xsl:if test="($row/../self::tbody and (count($row/preceding-sibling::row) mod 2 = 1)) or
-                  ($row/../self::db:tbody and (count($row/preceding-sibling::db:row) mod 2 = 1))">
-      <xsl:attribute name="class">
-        <xsl:text>shade</xsl:text>
-      </xsl:attribute>
-    </xsl:if>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="node" select="$row"/>
+      <xsl:with-param name="class">
+        <xsl:if test="($row/../self::tbody and (count($row/preceding-sibling::row) mod 2 = 1)) or
+                      ($row/../self::db:tbody and (count($row/preceding-sibling::db:row) mod 2 = 1))">
+          <xsl:text>shade</xsl:text>
+        </xsl:if>
+      </xsl:with-param>
+    </xsl:call-template>
     <xsl:if test="$row/*[1]">
       <xsl:call-template name="db2html.entry">
         <xsl:with-param name="entry" select="$row/*[1]"/>
@@ -424,16 +427,15 @@ element to output the next #{td}.
         <xsl:call-template name="html.lang.attrs">
           <xsl:with-param name="parent" select=".."/>
         </xsl:call-template>
+        <xsl:call-template name="html.class.attr">
+          <xsl:with-param name="node" select="$entry"/>
+          <xsl:with-param name="class" select="$class"/>
+        </xsl:call-template>
         <xsl:if test="$style != ''">
           <xsl:attribute name="style">
             <xsl:value-of select="normalize-space($style)"/>
           </xsl:attribute>
         </xsl:if>
-        <xsl:if test="$class != ''">
-          <xsl:attribute name="class">
-            <xsl:value-of select="normalize-space($class)"/>
-          </xsl:attribute>
-        </xsl:if>
         <xsl:if test="number($rowspan) &gt; 1">
           <xsl:attribute name="rowspan">
             <xsl:value-of select="$rowspan"/>
@@ -957,6 +959,7 @@ REMARK: This template needs to be explained in detail, but I forgot how it works
     </xsl:choose>
   </xsl:variable>
   <table>
+    <xsl:call-template name="html.class.attr"/>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:apply-templates select="thead | db:thead">
       <xsl:with-param name="colspecs" select="colspec | db:colspec"/>
@@ -975,7 +978,10 @@ REMARK: This template needs to be explained in detail, but I forgot how it works
 
 <!-- = table = -->
 <xsl:template match="table | informaltable | db:table | db:informaltable">
-  <div class="table">
+  <div>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'table'"/>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:call-template name="db2html.anchor"/>
     <xsl:apply-templates select="title | db:title | db:info/db:title"/>
@@ -1072,7 +1078,13 @@ REMARK: This template needs to be explained in detail, but I forgot how it works
     </xsl:if>
   </xsl:variable>
   <table>
-    <xsl:call-template name="html.lang.attrs"/>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="node" select="$node"/>
+      <xsl:with-param name="class" select="$class"/>
+    </xsl:call-template>
+    <xsl:call-template name="html.lang.attrs">
+      <xsl:with-param name="node" select="$node"/>
+    </xsl:call-template>
     <xsl:if test="$table/title or $table/db:title or $table/db:info/db:title">
       <xsl:attribute name="summary">
         <xsl:value-of select="$table/title | $table/db:title | $table/db:info/db:title"/>
@@ -1083,11 +1095,6 @@ REMARK: This template needs to be explained in detail, but I forgot how it works
         <xsl:value-of select="normalize-space($style)"/>
       </xsl:attribute>
     </xsl:if>
-    <xsl:if test="$class != ''">
-      <xsl:attribute name="class">
-        <xsl:value-of select="normalize-space($class)"/>
-      </xsl:attribute>
-    </xsl:if>
     <xsl:choose>
       <xsl:when test="tr | db:tr">
         <tbody>
@@ -1129,6 +1136,7 @@ REMARK: This template needs to be explained in detail, but I forgot how it works
   <xsl:param name="rowsep" select="''"/>
   <xsl:element name="{local-name(.)}" namespace="{$html.namespace}">
     <xsl:call-template name="html.lang.attrs"/>
+    <xsl:call-template name="html.class.attr"/>
     <xsl:if test="@valign">
       <xsl:attribute name="valign">
         <xsl:value-of select="@valign"/>
@@ -1167,6 +1175,7 @@ REMARK: This template needs to be explained in detail, but I forgot how it works
 <xsl:template match="tr | db:tr">
   <tr>
     <xsl:call-template name="html.lang.attrs"/>
+    <xsl:call-template name="html.class.attr"/>
     <xsl:choose>
       <xsl:when test="@align = 'left' or @align = 'center' or 
                       @align = 'right' or @align = 'justify' ">
@@ -1198,6 +1207,7 @@ REMARK: This template needs to be explained in detail, but I forgot how it works
 <xsl:template match="td | th | db:td | db:th">
   <xsl:element name="{local-name(.)}" namespace="{$html.namespace}">
     <xsl:call-template name="html.lang.attrs"/>
+    <xsl:call-template name="html.class.attr"/>
     <xsl:copy-of select="@valign | @rowspan | @colspan"/>
     <xsl:choose>
       <xsl:when test="@align = 'left' or @align = 'center' or 
diff --git a/xslt/docbook/html/db2html-xref.xsl b/xslt/docbook/html/db2html-xref.xsl
index 28a6b17..f2b6677 100644
--- a/xslt/docbook/html/db2html-xref.xsl
+++ b/xslt/docbook/html/db2html-xref.xsl
@@ -57,7 +57,10 @@ REMARK: Describe this template
 <xsl:template name="db2html.link" match="link">
   <xsl:param name="linkend" select="@linkend"/>
   <xsl:param name="target" select="key('db.id.key', $linkend)"/>
-  <a class="link">
+  <a>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'link'"/>
+    </xsl:call-template>
     <xsl:attribute name="href">
       <xsl:call-template name="db.xref.target">
         <xsl:with-param name="linkend" select="$linkend"/>
@@ -92,7 +95,10 @@ REMARK: Describe this template
 <xsl:template name="db2html.ulink" match="ulink">
   <xsl:param name="url" select="@url"/>
   <xsl:param name="content" select="false()"/>
-  <a class="ulink" href="{$url}">
+  <a href="{$url}">
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'ulink'"/>
+    </xsl:call-template>
     <xsl:attribute name="title">
       <xsl:call-template name="db.ulink.tooltip"/>
     </xsl:attribute>
@@ -165,7 +171,10 @@ REMARK: Describe this template
   <xsl:param name="endterm"   select="@endterm"/>
   <xsl:param name="xrefstyle" select="@xrefstyle"/>
   <xsl:param name="content"   select="false()"/>
-  <a class="xref">
+  <a>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'xref'"/>
+    </xsl:call-template>
     <xsl:attribute name="href">
       <xsl:call-template name="db.xref.target">
         <xsl:with-param name="linkend" select="$linkend"/>
diff --git a/xslt/mallard/html/mal2html-block.xsl b/xslt/mallard/html/mal2html-block.xsl
index 1eec1ae..93b66cf 100644
--- a/xslt/mallard/html/mal2html-block.xsl
+++ b/xslt/mallard/html/mal2html-block.xsl
@@ -59,13 +59,16 @@ syntax highlighting support based on the #{mime} attribute of ${node}.
     <xsl:call-template name="html.lang.attrs">
       <xsl:with-param name="node" select="$node"/>
     </xsl:call-template>
-    <xsl:attribute name="class">
-      <xsl:value-of select="local-name($node)"/>
-      <xsl:if test="$if != 'true'">
-        <xsl:text> if-if </xsl:text>
-        <xsl:value-of select="$if"/>
-      </xsl:if>
-    </xsl:attribute>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="node" select="$node"/>
+      <xsl:with-param name="class">
+        <xsl:value-of select="local-name($node)"/>
+        <xsl:if test="$if != 'true'">
+          <xsl:text> if-if </xsl:text>
+          <xsl:value-of select="$if"/>
+        </xsl:if>
+      </xsl:with-param>
+    </xsl:call-template>
     <xsl:if test="$numbered">
       <pre class="numbered"><xsl:call-template name="utils.linenumbering">
         <xsl:with-param name="node" select="$node"/>
@@ -194,12 +197,14 @@ in accordance with the Mallard specification on fallback block content.
 <!-- = desc = -->
 <xsl:template mode="mal2html.block.mode" match="mal:desc">
   <div>
-    <xsl:attribute name="class">
-      <xsl:text>desc</xsl:text>
-      <xsl:if test="contains(concat(' ', @style, ' '), ' center ')">
-        <xsl:text> center</xsl:text>
-      </xsl:if>
-    </xsl:attribute>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class">
+        <xsl:text>desc</xsl:text>
+        <xsl:if test="contains(concat(' ', @style, ' '), ' center ')">
+          <xsl:text> center</xsl:text>
+        </xsl:if>
+      </xsl:with-param>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:apply-templates mode="mal2html.inline.mode"/>
   </div>
@@ -217,16 +222,18 @@ in accordance with the Mallard specification on fallback block content.
                 or processing-instruction('mal2html.show_comment')">
     <div>
       <xsl:call-template name="html.lang.attrs"/>
-      <xsl:attribute name="class">
-        <xsl:text>comment</xsl:text>
-        <xsl:if test="mal:title and (@ui:expanded or @uix:expanded)">
-          <xsl:text> ui-expander</xsl:text>
-        </xsl:if>
-        <xsl:if test="$if != 'true'">
-          <xsl:text> if-if </xsl:text>
-          <xsl:value-of select="$if"/>
-        </xsl:if>
-      </xsl:attribute>
+      <xsl:call-template name="html.class.attr">
+        <xsl:with-param name="class">
+          <xsl:text>comment</xsl:text>
+          <xsl:if test="mal:title and (@ui:expanded or @uix:expanded)">
+            <xsl:text> ui-expander</xsl:text>
+          </xsl:if>
+          <xsl:if test="$if != 'true'">
+            <xsl:text> if-if </xsl:text>
+            <xsl:value-of select="$if"/>
+          </xsl:if>
+        </xsl:with-param>
+      </xsl:call-template>
       <xsl:call-template name="mal2html.ui.expander.data"/>
       <div class="inner">
         <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
@@ -246,7 +253,10 @@ in accordance with the Mallard specification on fallback block content.
 
 <!-- = comment/cite = -->
 <xsl:template mode="mal2html.block.mode" match="mal:comment/mal:cite">
-  <div class="cite cite-comment">
+  <div>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'cite cite-comment'"/>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:choose>
       <xsl:when test="@date">
@@ -290,13 +300,15 @@ in accordance with the Mallard specification on fallback block content.
 <xsl:template mode="mal2html.block.mode" match="mal:example">
   <xsl:variable name="if"><xsl:call-template name="mal.if.test"/></xsl:variable><xsl:if test="$if != ''">
   <div>
-    <xsl:attribute name="class">
-      <xsl:text>example</xsl:text>
-      <xsl:if test="$if != 'true'">
-        <xsl:text> if-if </xsl:text>
-        <xsl:value-of select="$if"/>
-      </xsl:if>
-    </xsl:attribute>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class">
+        <xsl:text>example</xsl:text>
+        <xsl:if test="$if != 'true'">
+          <xsl:text> if-if </xsl:text>
+          <xsl:value-of select="$if"/>
+        </xsl:if>
+      </xsl:with-param>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:apply-templates mode="mal2html.block.mode"/>
   </div>
@@ -308,16 +320,18 @@ in accordance with the Mallard specification on fallback block content.
   <xsl:variable name="if"><xsl:call-template name="mal.if.test"/></xsl:variable><xsl:if test="$if != ''">
   <div>
     <xsl:call-template name="html.lang.attrs"/>
-    <xsl:attribute name="class">
-      <xsl:text>figure</xsl:text>
-      <xsl:if test="mal:title and (@ui:expanded or @uix:expanded)">
-        <xsl:text> ui-expander</xsl:text>
-      </xsl:if>
-      <xsl:if test="$if != 'true'">
-        <xsl:text> if-if </xsl:text>
-        <xsl:value-of select="$if"/>
-      </xsl:if>
-    </xsl:attribute>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class">
+        <xsl:text>figure</xsl:text>
+        <xsl:if test="mal:title and (@ui:expanded or @uix:expanded)">
+          <xsl:text> ui-expander</xsl:text>
+        </xsl:if>
+        <xsl:if test="$if != 'true'">
+          <xsl:text> if-if </xsl:text>
+          <xsl:value-of select="$if"/>
+        </xsl:if>
+      </xsl:with-param>
+    </xsl:call-template>
     <xsl:call-template name="mal2html.ui.expander.data"/>
     <div class="inner">
       <a href="#" class="zoom">
@@ -351,16 +365,18 @@ in accordance with the Mallard specification on fallback block content.
   <xsl:variable name="if"><xsl:call-template name="mal.if.test"/></xsl:variable><xsl:if test="$if != ''">
   <div>
     <xsl:call-template name="html.lang.attrs"/>
-    <xsl:attribute name="class">
-      <xsl:text>listing</xsl:text>
-      <xsl:if test="mal:title and (@ui:expanded or @uix:expanded)">
-        <xsl:text> ui-expander</xsl:text>
-      </xsl:if>
-      <xsl:if test="$if != 'true'">
-        <xsl:text> if-if </xsl:text>
-        <xsl:value-of select="$if"/>
-      </xsl:if>
-    </xsl:attribute>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class">
+        <xsl:text>listing</xsl:text>
+        <xsl:if test="mal:title and (@ui:expanded or @uix:expanded)">
+          <xsl:text> ui-expander</xsl:text>
+        </xsl:if>
+        <xsl:if test="$if != 'true'">
+          <xsl:text> if-if </xsl:text>
+          <xsl:value-of select="$if"/>
+        </xsl:if>
+      </xsl:with-param>
+    </xsl:call-template>
     <xsl:call-template name="mal2html.ui.expander.data"/>
     <div class="inner">
       <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
@@ -410,19 +426,21 @@ in accordance with the Mallard specification on fallback block content.
   </xsl:variable>
   <div>
     <xsl:call-template name="html.lang.attrs"/>
-    <xsl:attribute name="class">
-      <xsl:text>note</xsl:text>
-      <xsl:if test="$notestyle != 'Note'">
-        <xsl:value-of select="concat(' note-', translate($notestyle, 'ABISTW', 'abistw'))"/>
-      </xsl:if>
-      <xsl:if test="mal:title and (@ui:expanded or @uix:expanded)">
-        <xsl:text> ui-expander</xsl:text>
-      </xsl:if>
-      <xsl:if test="$if != 'true'">
-        <xsl:text> if-if </xsl:text>
-        <xsl:value-of select="$if"/>
-      </xsl:if>
-    </xsl:attribute>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class">
+        <xsl:text>note</xsl:text>
+        <xsl:if test="$notestyle != 'Note'">
+          <xsl:value-of select="concat(' note-', translate($notestyle, 'ABISTW', 'abistw'))"/>
+        </xsl:if>
+        <xsl:if test="mal:title and (@ui:expanded or @uix:expanded)">
+          <xsl:text> ui-expander</xsl:text>
+        </xsl:if>
+        <xsl:if test="$if != 'true'">
+          <xsl:text> if-if </xsl:text>
+          <xsl:value-of select="$if"/>
+        </xsl:if>
+      </xsl:with-param>
+    </xsl:call-template>
     <xsl:if test="$notestyle != 'plain'">
       <xsl:attribute name="title">
         <xsl:call-template name="l10n.gettext">
@@ -455,13 +473,15 @@ in accordance with the Mallard specification on fallback block content.
 <xsl:template mode="mal2html.block.mode" match="mal:p">
   <xsl:variable name="if"><xsl:call-template name="mal.if.test"/></xsl:variable><xsl:if test="$if != ''">
   <p>
-    <xsl:attribute name="class">
-      <xsl:text>p</xsl:text>
-      <xsl:if test="$if != 'true'">
-        <xsl:text> if-if </xsl:text>
-        <xsl:value-of select="$if"/>
-      </xsl:if>
-    </xsl:attribute>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class">
+        <xsl:text>p</xsl:text>
+        <xsl:if test="$if != 'true'">
+          <xsl:text> if-if </xsl:text>
+          <xsl:value-of select="$if"/>
+        </xsl:if>
+      </xsl:with-param>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:apply-templates mode="mal2html.inline.mode"/>
   </p>
@@ -473,16 +493,18 @@ in accordance with the Mallard specification on fallback block content.
   <xsl:variable name="if"><xsl:call-template name="mal.if.test"/></xsl:variable><xsl:if test="$if != ''">
   <div>
     <xsl:call-template name="html.lang.attrs"/>
-    <xsl:attribute name="class">
-      <xsl:text>quote</xsl:text>
-      <xsl:if test="mal:title and (@ui:expanded or @uix:expanded)">
-        <xsl:text> ui-expander</xsl:text>
-      </xsl:if>
-      <xsl:if test="$if != 'true'">
-        <xsl:text> if-if </xsl:text>
-        <xsl:value-of select="$if"/>
-      </xsl:if>
-    </xsl:attribute>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class">
+        <xsl:text>quote</xsl:text>
+        <xsl:if test="mal:title and (@ui:expanded or @uix:expanded)">
+          <xsl:text> ui-expander</xsl:text>
+        </xsl:if>
+        <xsl:if test="$if != 'true'">
+          <xsl:text> if-if </xsl:text>
+          <xsl:value-of select="$if"/>
+        </xsl:if>
+      </xsl:with-param>
+    </xsl:call-template>
     <xsl:call-template name="mal2html.ui.expander.data"/>
     <div class="inner">
       <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
@@ -501,7 +523,10 @@ in accordance with the Mallard specification on fallback block content.
 
 <!-- = quote/cite = -->
 <xsl:template mode="mal2html.block.mode" match="mal:quote/mal:cite">
-  <div class="cite cite-quote">
+  <div>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'cite cite-quote'"/>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:choose>
       <xsl:when test="@href">
@@ -532,16 +557,18 @@ in accordance with the Mallard specification on fallback block content.
   <xsl:variable name="if"><xsl:call-template name="mal.if.test"/></xsl:variable><xsl:if test="$if != ''">
   <div>
     <xsl:call-template name="html.lang.attrs"/>
-    <xsl:attribute name="class">
-      <xsl:text>synopsis</xsl:text>
-      <xsl:if test="mal:title and (@ui:expanded or @uix:expanded)">
-        <xsl:text> ui-expander</xsl:text>
-      </xsl:if>
-      <xsl:if test="$if != 'true'">
-        <xsl:text> if-if </xsl:text>
-        <xsl:value-of select="$if"/>
-      </xsl:if>
-    </xsl:attribute>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class">
+        <xsl:text>synopsis</xsl:text>
+        <xsl:if test="mal:title and (@ui:expanded or @uix:expanded)">
+          <xsl:text> ui-expander</xsl:text>
+        </xsl:if>
+        <xsl:if test="$if != 'true'">
+          <xsl:text> if-if </xsl:text>
+          <xsl:value-of select="$if"/>
+        </xsl:if>
+      </xsl:with-param>
+    </xsl:call-template>
     <xsl:call-template name="mal2html.ui.expander.data"/>
     <div class="inner">
       <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
@@ -573,16 +600,18 @@ in accordance with the Mallard specification on fallback block content.
   </xsl:variable>
   <xsl:variable name="style" select="concat(' ', @style, ' ')"/>
   <div>
-    <xsl:attribute name="class">
-      <xsl:text>title title-</xsl:text>
-      <xsl:value-of select="local-name(..)"/>
-      <xsl:if test="contains($style, ' heading ')">
-        <xsl:text> title-heading</xsl:text>
-      </xsl:if>
-      <xsl:if test="contains($style, ' center ')">
-        <xsl:text> center</xsl:text>
-      </xsl:if>
-    </xsl:attribute>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class">
+        <xsl:text>title title-</xsl:text>
+        <xsl:value-of select="local-name(..)"/>
+        <xsl:if test="contains($style, ' heading ')">
+          <xsl:text> title-heading</xsl:text>
+        </xsl:if>
+        <xsl:if test="contains($style, ' center ')">
+          <xsl:text> center</xsl:text>
+        </xsl:if>
+      </xsl:with-param>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:element name="{concat('h', $depth_)}" namespace="{$html.namespace}">
       <span class="title">
diff --git a/xslt/mallard/html/mal2html-gloss.xsl b/xslt/mallard/html/mal2html-gloss.xsl
index 5d66985..f6e908d 100644
--- a/xslt/mallard/html/mal2html-gloss.xsl
+++ b/xslt/mallard/html/mal2html-gloss.xsl
@@ -101,7 +101,10 @@ include a link to their defining page.
 
 <xsl:template mode="mal2html.inline.mode" match="gloss:term">
   <xsl:variable name="node" select="."/>
-  <a class="gloss-term">
+  <a>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'gloss-term'"/>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:variable name="target">
       <xsl:call-template name="mal.link.target">
diff --git a/xslt/mallard/html/mal2html-inline.xsl b/xslt/mallard/html/mal2html-inline.xsl
index e2256b0..f42dee5 100644
--- a/xslt/mallard/html/mal2html-inline.xsl
+++ b/xslt/mallard/html/mal2html-inline.xsl
@@ -80,14 +80,14 @@ template.
 <!--**==========================================================================
 mal2html.span
 Output an HTML #{span} element.
-:Revision:version="1.0" date="2010-06-03" status="final"
+:Revision:version="3.10" date="2013-07-10" status="final"
 $node: The source element to output a #{span} for.
 $class: An additional string to prepend to the #{class} attribute.
 
 This template outputs an HTML #{span} element for a source element. It creates
-a #{class} attribute automatically from the #{class} attribute of ${node},
-prepending any value set in the ${class} parameter. To output the contents
-of ${node}, it applies the mode %{mal2html.inline.content.mode} to ${node}.
+a #{class} attribute automatically by passing the local name of ${node} and the
+${class} parameter to *{html.class.attr}. To output the contents of ${node}, it
+applies the mode %{mal2html.inline.content.mode} to ${node}.
 
 This template automatically handles ubiquitous linking if ${node} contains
 an #{xref} or #{href} attribute.
@@ -95,7 +95,11 @@ an #{xref} or #{href} attribute.
 <xsl:template name="mal2html.span">
   <xsl:param name="node" select="."/>
   <xsl:param name="class" select="''"/>
-  <span class="{concat($class, ' ', local-name($node))}">
+  <span>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="node" select="$node"/>
+      <xsl:with-param name="class" select="concat($class, ' ', local-name($node))"/>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs">
       <xsl:with-param name="node" select="$node"/>
     </xsl:call-template>
diff --git a/xslt/mallard/html/mal2html-links.xsl b/xslt/mallard/html/mal2html-links.xsl
index bb8565e..00b4bb0 100644
--- a/xslt/mallard/html/mal2html-links.xsl
+++ b/xslt/mallard/html/mal2html-links.xsl
@@ -91,18 +91,21 @@ parameter will be used if provided.
     </xsl:choose>
   </xsl:variable>
   <div>
-    <xsl:attribute name="class">
-      <xsl:text>links </xsl:text>
-      <xsl:if test="$role != ''">
-        <xsl:value-of select="concat($role, 'links')"/>
-      </xsl:if>
-      <xsl:if test="$expander">
-        <xsl:text> ui-expander</xsl:text>
-      </xsl:if>
-      <xsl:if test="contains($style, ' center ')">
-        <xsl:text> links-center</xsl:text>
-      </xsl:if>
-    </xsl:attribute>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="node" select="$node[self::mal:links]"/>
+      <xsl:with-param name="class">
+        <xsl:text>links </xsl:text>
+        <xsl:if test="$role != ''">
+          <xsl:value-of select="concat($role, 'links')"/>
+        </xsl:if>
+        <xsl:if test="$expander">
+          <xsl:text> ui-expander</xsl:text>
+        </xsl:if>
+        <xsl:if test="contains($style, ' center ')">
+          <xsl:text> links-center</xsl:text>
+        </xsl:if>
+      </xsl:with-param>
+    </xsl:call-template>
     <xsl:call-template name="mal2html.ui.expander.data">
       <xsl:with-param name="node" select="$node"/>
       <xsl:with-param name="expander" select="$expander"/>
diff --git a/xslt/mallard/html/mal2html-list.xsl b/xslt/mallard/html/mal2html-list.xsl
index 0904640..e30f93b 100644
--- a/xslt/mallard/html/mal2html-list.xsl
+++ b/xslt/mallard/html/mal2html-list.xsl
@@ -53,16 +53,18 @@ as well as any special processing for child #{item} elements.
   </xsl:variable>
   <div>
     <xsl:call-template name="html.lang.attrs"/>
-    <xsl:attribute name="class">
-      <xsl:text>list</xsl:text>
-      <xsl:if test="mal:title and (@ui:expanded or @uix:expanded)">
-        <xsl:text> ui-expander</xsl:text>
-      </xsl:if>
-      <xsl:if test="$if != 'true'">
-        <xsl:text> if-if </xsl:text>
-        <xsl:value-of select="$if"/>
-      </xsl:if>
-    </xsl:attribute>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class">
+        <xsl:text>list</xsl:text>
+        <xsl:if test="mal:title and (@ui:expanded or @uix:expanded)">
+          <xsl:text> ui-expander</xsl:text>
+        </xsl:if>
+        <xsl:if test="$if != 'true'">
+          <xsl:text> if-if </xsl:text>
+          <xsl:value-of select="$if"/>
+        </xsl:if>
+      </xsl:with-param>
+    </xsl:call-template>
     <xsl:call-template name="mal2html.ui.expander.data"/>
     <div class="inner">
       <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
@@ -96,13 +98,15 @@ as well as any special processing for child #{item} elements.
 <xsl:template match="mal:list/mal:item">
   <xsl:variable name="if"><xsl:call-template name="mal.if.test"/></xsl:variable><xsl:if test="$if != ''">
   <li>
-    <xsl:attribute name="class">
-      <xsl:text>list</xsl:text>
-      <xsl:if test="$if != 'true'">
-        <xsl:text> if-if </xsl:text>
-        <xsl:value-of select="$if"/>
-      </xsl:if>
-    </xsl:attribute>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class">
+        <xsl:text>list</xsl:text>
+        <xsl:if test="$if != 'true'">
+          <xsl:text> if-if </xsl:text>
+          <xsl:value-of select="$if"/>
+        </xsl:if>
+      </xsl:with-param>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:apply-templates mode="mal2html.block.mode"/>
   </li>
@@ -114,16 +118,18 @@ as well as any special processing for child #{item} elements.
   <xsl:variable name="if"><xsl:call-template name="mal.if.test"/></xsl:variable><xsl:if test="$if != ''">
   <div>
     <xsl:call-template name="html.lang.attrs"/>
-    <xsl:attribute name="class">
-      <xsl:text>steps</xsl:text>
-      <xsl:if test="mal:title and (@ui:expanded or @uix:expanded)">
-        <xsl:text> ui-expander</xsl:text>
-      </xsl:if>
-      <xsl:if test="$if != 'true'">
-        <xsl:text> if-if </xsl:text>
-        <xsl:value-of select="$if"/>
-      </xsl:if>
-    </xsl:attribute>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class">
+        <xsl:text>steps</xsl:text>
+        <xsl:if test="mal:title and (@ui:expanded or @uix:expanded)">
+          <xsl:text> ui-expander</xsl:text>
+        </xsl:if>
+        <xsl:if test="$if != 'true'">
+          <xsl:text> if-if </xsl:text>
+          <xsl:value-of select="$if"/>
+        </xsl:if>
+      </xsl:with-param>
+    </xsl:call-template>
     <xsl:call-template name="mal2html.ui.expander.data"/>
     <div class="inner">
       <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
@@ -172,13 +178,15 @@ as well as any special processing for child #{item} elements.
 <xsl:template match="mal:steps/mal:item">
   <xsl:variable name="if"><xsl:call-template name="mal.if.test"/></xsl:variable><xsl:if test="$if != ''">
   <li>
-    <xsl:attribute name="class">
-      <xsl:text>steps</xsl:text>
-      <xsl:if test="$if != 'true'">
-        <xsl:text> if-if </xsl:text>
-        <xsl:value-of select="$if"/>
-      </xsl:if>
-    </xsl:attribute>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class">
+        <xsl:text>steps</xsl:text>
+        <xsl:if test="$if != 'true'">
+          <xsl:text> if-if </xsl:text>
+          <xsl:value-of select="$if"/>
+        </xsl:if>
+      </xsl:with-param>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:apply-templates mode="mal2html.block.mode"/>
   </li>
@@ -191,16 +199,18 @@ as well as any special processing for child #{item} elements.
   <xsl:variable name="style" select="concat(' ', @style, ' ')"/>
   <div>
     <xsl:call-template name="html.lang.attrs"/>
-    <xsl:attribute name="class">
-      <xsl:text>terms</xsl:text>
-      <xsl:if test="mal:title and (@ui:expanded or @uix:expanded)">
-        <xsl:text> ui-expander</xsl:text>
-      </xsl:if>
-      <xsl:if test="$if != 'true'">
-        <xsl:text> if-if </xsl:text>
-        <xsl:value-of select="$if"/>
-      </xsl:if>
-    </xsl:attribute>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class">
+        <xsl:text>terms</xsl:text>
+        <xsl:if test="mal:title and (@ui:expanded or @uix:expanded)">
+          <xsl:text> ui-expander</xsl:text>
+        </xsl:if>
+        <xsl:if test="$if != 'true'">
+          <xsl:text> if-if </xsl:text>
+          <xsl:value-of select="$if"/>
+        </xsl:if>
+      </xsl:with-param>
+    </xsl:call-template>
     <xsl:call-template name="mal2html.ui.expander.data"/>
     <div class="inner">
       <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
@@ -225,13 +235,15 @@ as well as any special processing for child #{item} elements.
   <xsl:variable name="if"><xsl:call-template name="mal.if.test"/></xsl:variable><xsl:if test="$if != ''">
   <xsl:for-each select="mal:title">
     <dt>
-      <xsl:attribute name="class">
-        <xsl:text>terms</xsl:text>
-        <xsl:if test="$if != 'true'">
-          <xsl:text> if-if </xsl:text>
-          <xsl:value-of select="$if"/>
-        </xsl:if>
-      </xsl:attribute>
+      <xsl:call-template name="html.class.attr">
+        <xsl:with-param name="class">
+          <xsl:text>terms</xsl:text>
+          <xsl:if test="$if != 'true'">
+            <xsl:text> if-if </xsl:text>
+            <xsl:value-of select="$if"/>
+          </xsl:if>
+        </xsl:with-param>
+      </xsl:call-template>
       <xsl:call-template name="html.lang.attrs">
         <xsl:with-param name="parent" select=".."/>
       </xsl:call-template>
@@ -239,13 +251,15 @@ as well as any special processing for child #{item} elements.
     </dt>
   </xsl:for-each>
   <dd>
-    <xsl:attribute name="class">
-      <xsl:text>terms</xsl:text>
-      <xsl:if test="$if != 'true'">
-        <xsl:text> if-if </xsl:text>
-        <xsl:value-of select="$if"/>
-      </xsl:if>
-    </xsl:attribute>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class">
+        <xsl:text>terms</xsl:text>
+        <xsl:if test="$if != 'true'">
+          <xsl:text> if-if </xsl:text>
+          <xsl:value-of select="$if"/>
+        </xsl:if>
+      </xsl:with-param>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:apply-templates mode="mal2html.block.mode" select="*[not(self::mal:title)]"/>
   </dd>
@@ -258,19 +272,21 @@ as well as any special processing for child #{item} elements.
   <xsl:variable name="lines" select="contains(concat(' ', @style, ' '), ' lines ')"/>
   <div>
     <xsl:call-template name="html.lang.attrs"/>
-    <xsl:attribute name="class">
-      <xsl:text>tree</xsl:text>
-      <xsl:if test="$lines">
-        <xsl:text> tree-lines</xsl:text>
-      </xsl:if>
-      <xsl:if test="mal:title and (@ui:expanded or @uix:expanded)">
-        <xsl:text> ui-expander</xsl:text>
-      </xsl:if>
-      <xsl:if test="$if != 'true'">
-        <xsl:text> if-if </xsl:text>
-        <xsl:value-of select="$if"/>
-      </xsl:if>
-    </xsl:attribute>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class">
+        <xsl:text>tree</xsl:text>
+        <xsl:if test="$lines">
+          <xsl:text> tree-lines</xsl:text>
+        </xsl:if>
+        <xsl:if test="mal:title and (@ui:expanded or @uix:expanded)">
+          <xsl:text> ui-expander</xsl:text>
+        </xsl:if>
+        <xsl:if test="$if != 'true'">
+          <xsl:text> if-if </xsl:text>
+          <xsl:value-of select="$if"/>
+        </xsl:if>
+      </xsl:with-param>
+    </xsl:call-template>
     <xsl:call-template name="mal2html.ui.expander.data"/>
     <div class="inner">
       <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
@@ -318,13 +334,15 @@ neighboring #{item} elements, and passes that prefix to child elements.
   </xsl:variable>
   <xsl:if test="$if != ''">
   <li>
-    <xsl:attribute name="class">
-      <xsl:text>tree</xsl:text>
-      <xsl:if test="$if != 'true'">
-        <xsl:text> if-if </xsl:text>
-        <xsl:value-of select="$if"/>
-      </xsl:if>
-    </xsl:attribute>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class">
+        <xsl:text>tree</xsl:text>
+        <xsl:if test="$if != 'true'">
+          <xsl:text> if-if </xsl:text>
+          <xsl:value-of select="$if"/>
+        </xsl:if>
+      </xsl:with-param>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <div>
       <xsl:if test="$lines">
diff --git a/xslt/mallard/html/mal2html-math.xsl b/xslt/mallard/html/mal2html-math.xsl
index b46ca22..813d375 100644
--- a/xslt/mallard/html/mal2html-math.xsl
+++ b/xslt/mallard/html/mal2html-math.xsl
@@ -108,7 +108,10 @@ attributes from MathML 2 to #{href} attributes for MathML 3.
 </xsl:template>
 
 <xsl:template mode="mal2html.inline.mode" match="mml:math">
-  <span class="math">
+  <span>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'math'"/>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:element name="math" namespace="{$html.mathml.namespace}">
       <xsl:for-each select="@*[name(.) != 'display']
diff --git a/xslt/mallard/html/mal2html-media.xsl b/xslt/mallard/html/mal2html-media.xsl
index 14f56aa..5dbceb8 100644
--- a/xslt/mallard/html/mal2html-media.xsl
+++ b/xslt/mallard/html/mal2html-media.xsl
@@ -65,7 +65,10 @@ If ${node} has fallback content, it is used for the #{alt} attribute.
     <xsl:attribute name="alt">
       <xsl:choose>
         <xsl:when test="$inline">
-          <xsl:value-of select="$node"/>
+          <xsl:variable name="alt">
+            <xsl:apply-templates mode="mal2html.inline.mode" select="$node/node()"/>
+          </xsl:variable>
+          <xsl:value-of select="normalize-space($alt)"/>
         </xsl:when>
         <xsl:otherwise>
           <!-- FIXME: This is not ideal.  Nested block container elements
@@ -87,6 +90,7 @@ If ${node} has fallback content, it is used for the #{alt} attribute.
   </img>
 </xsl:template>
 
+
 <!--**==========================================================================
 mal2html.media.video
 Output a #{video} element for a video.
@@ -255,27 +259,29 @@ the parent media element is played.
 
 <xsl:template mode="mal2html.ttml.mode" match="tt:body">
   <div>
-    <xsl:attribute name="class">
-      <xsl:text>media-ttml</xsl:text>
-      <xsl:choose>
-        <xsl:when test="@xml:space">
-          <xsl:if test="@xml:space='preserve'">
-            <xsl:text> media-ttml-pre</xsl:text>
-          </xsl:if>
-          <xsl:if test="@xml:space='default'">
-            <xsl:text> media-ttml-nopre</xsl:text>
-          </xsl:if>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:if test="../@xml:space='preserve'">
-            <xsl:text> media-ttml-pre</xsl:text>
-          </xsl:if>
-          <xsl:if test="../@xml:space='default'">
-            <xsl:text> media-ttml-nopre</xsl:text>
-          </xsl:if>
-        </xsl:otherwise>
-      </xsl:choose>
-    </xsl:attribute>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class">
+        <xsl:text>media-ttml</xsl:text>
+        <xsl:choose>
+          <xsl:when test="@xml:space">
+            <xsl:if test="@xml:space='preserve'">
+              <xsl:text> media-ttml-pre</xsl:text>
+            </xsl:if>
+            <xsl:if test="@xml:space='default'">
+              <xsl:text> media-ttml-nopre</xsl:text>
+            </xsl:if>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:if test="../@xml:space='preserve'">
+              <xsl:text> media-ttml-pre</xsl:text>
+            </xsl:if>
+            <xsl:if test="../@xml:space='default'">
+              <xsl:text> media-ttml-nopre</xsl:text>
+            </xsl:if>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:with-param>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs">
       <xsl:with-param name="parent" select="../self::tt:tt"/>
     </xsl:call-template>
@@ -295,15 +301,17 @@ the parent media element is played.
     </xsl:call-template>
   </xsl:variable>
   <div>
-    <xsl:attribute name="class">
-      <xsl:text>media-ttml-node media-ttml-div</xsl:text>
-      <xsl:if test="@xml:space='preserve'">
-        <xsl:text> media-ttml-pre</xsl:text>
-      </xsl:if>
-      <xsl:if test="@xml:space='default'">
-        <xsl:text> media-ttml-nopre</xsl:text>
-      </xsl:if>
-    </xsl:attribute>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class">
+        <xsl:text>media-ttml-node media-ttml-div</xsl:text>
+        <xsl:if test="@xml:space='preserve'">
+          <xsl:text> media-ttml-pre</xsl:text>
+        </xsl:if>
+        <xsl:if test="@xml:space='default'">
+          <xsl:text> media-ttml-nopre</xsl:text>
+        </xsl:if>
+      </xsl:with-param>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:copy-of select="@xml:space"/>
     <xsl:attribute name="data-ttml-begin">
@@ -338,15 +346,17 @@ the parent media element is played.
     </xsl:call-template>
   </xsl:variable>
   <div>
-    <xsl:attribute name="class">
-      <xsl:text>media-ttml-node media-ttml-p</xsl:text>
-      <xsl:if test="@xml:space='preserve'">
-        <xsl:text> media-ttml-pre</xsl:text>
-      </xsl:if>
-      <xsl:if test="@xml:space='default'">
-        <xsl:text> media-ttml-nopre</xsl:text>
-      </xsl:if>
-    </xsl:attribute>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class">
+        <xsl:text>media-ttml-node media-ttml-p</xsl:text>
+        <xsl:if test="@xml:space='preserve'">
+          <xsl:text> media-ttml-pre</xsl:text>
+        </xsl:if>
+        <xsl:if test="@xml:space='default'">
+          <xsl:text> media-ttml-nopre</xsl:text>
+        </xsl:if>
+      </xsl:with-param>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:attribute name="data-ttml-begin">
       <xsl:value-of select="substring-before($beginend, ',')"/>
@@ -371,15 +381,17 @@ the parent media element is played.
     </xsl:call-template>
   </xsl:variable>
   <span>
-    <xsl:attribute name="class">
-      <xsl:text>media-ttml-node media-ttml-span</xsl:text>
-      <xsl:if test="@xml:space='preserve'">
-        <xsl:text> media-ttml-pre</xsl:text>
-      </xsl:if>
-      <xsl:if test="@xml:space='default'">
-        <xsl:text> media-ttml-nopre</xsl:text>
-      </xsl:if>
-    </xsl:attribute>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class">
+        <xsl:text>media-ttml-node media-ttml-span</xsl:text>
+        <xsl:if test="@xml:space='preserve'">
+          <xsl:text> media-ttml-pre</xsl:text>
+        </xsl:if>
+        <xsl:if test="@xml:space='default'">
+          <xsl:text> media-ttml-nopre</xsl:text>
+        </xsl:if>
+      </xsl:with-param>
+    </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:attribute name="data-ttml-begin">
       <xsl:value-of select="substring-before($beginend, ',')"/>
@@ -395,7 +407,11 @@ the parent media element is played.
 </xsl:template>
 
 <xsl:template mode="mal2html.inline.mode" match="tt:br">
-  <br class="media-ttml-br"/>
+  <br>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="'media-ttml-br'"/>
+    </xsl:call-template>
+  </br>
 </xsl:template>
 
 
@@ -428,14 +444,16 @@ the parent media element is played.
     <xsl:when test="$if = ''"/>
     <xsl:when test="@type = 'image' or not(@type)">
       <div>
-        <xsl:attribute name="class">
-          <xsl:text>media media-image</xsl:text>
-          <xsl:value-of select="$class"/>
-          <xsl:if test="$if != 'true'">
-            <xsl:text> if-if </xsl:text>
-            <xsl:value-of select="$if"/>
-          </xsl:if>
-        </xsl:attribute>
+        <xsl:call-template name="html.class.attr">
+          <xsl:with-param name="class">
+            <xsl:text>media media-image</xsl:text>
+            <xsl:value-of select="$class"/>
+            <xsl:if test="$if != 'true'">
+              <xsl:text> if-if </xsl:text>
+              <xsl:value-of select="$if"/>
+            </xsl:if>
+          </xsl:with-param>
+        </xsl:call-template>
         <div class="inner">
           <xsl:call-template name="mal2html.media.image"/>
         </div>
@@ -443,14 +461,16 @@ the parent media element is played.
     </xsl:when>
     <xsl:when test="@type = 'video'">
       <div>
-        <xsl:attribute name="class">
-          <xsl:text>media media-video</xsl:text>
-          <xsl:value-of select="$class"/>
-          <xsl:if test="$if != 'true'">
-            <xsl:text> if-if </xsl:text>
-            <xsl:value-of select="$if"/>
-          </xsl:if>
-        </xsl:attribute>
+        <xsl:call-template name="html.class.attr">
+          <xsl:with-param name="class">
+            <xsl:text>media media-video</xsl:text>
+            <xsl:value-of select="$class"/>
+            <xsl:if test="$if != 'true'">
+              <xsl:text> if-if </xsl:text>
+              <xsl:value-of select="$if"/>
+            </xsl:if>
+          </xsl:with-param>
+        </xsl:call-template>
         <div class="inner">
           <xsl:call-template name="mal2html.media.video"/>
         </div>
@@ -458,14 +478,16 @@ the parent media element is played.
     </xsl:when>
     <xsl:when test="@type = 'audio'">
       <div>
-        <xsl:attribute name="class">
-          <xsl:text>media media-audio</xsl:text>
-          <xsl:value-of select="$class"/>
-          <xsl:if test="$if != 'true'">
-            <xsl:text> if-if </xsl:text>
-            <xsl:value-of select="$if"/>
-          </xsl:if>
-        </xsl:attribute>
+        <xsl:call-template name="html.class.attr">
+          <xsl:with-param name="class">
+            <xsl:text>media media-audio</xsl:text>
+            <xsl:value-of select="$class"/>
+            <xsl:if test="$if != 'true'">
+              <xsl:text> if-if </xsl:text>
+              <xsl:value-of select="$if"/>
+            </xsl:if>
+          </xsl:with-param>
+        </xsl:call-template>
         <div class="inner">
           <xsl:call-template name="mal2html.media.audio"/>
         </div>
@@ -481,22 +503,7 @@ the parent media element is played.
 
 <!-- = mal2html.inline.mode % media = -->
 <xsl:template mode="mal2html.inline.mode" match="mal:media">
-  <xsl:choose>
-    <xsl:when test="@action | @xref | @href">
-      <a>
-        <xsl:attribute name="href">
-          <xsl:call-template name="mal.link.target"/>
-        </xsl:attribute>
-        <xsl:attribute name="title">
-          <xsl:call-template name="mal.link.tooltip"/>
-        </xsl:attribute>
-        <xsl:apply-templates mode="mal2html.inline.content.mode" select="."/>
-      </a>
-    </xsl:when>
-    <xsl:otherwise>
-      <xsl:apply-templates mode="mal2html.inline.content.mode" select="."/>
-    </xsl:otherwise>
-  </xsl:choose>
+  <xsl:call-template name="mal2html.span"/>
 </xsl:template>
 
 <xsl:template mode="mal2html.inline.content.mode" match="mal:media">
diff --git a/xslt/mallard/html/mal2html-page.xsl b/xslt/mallard/html/mal2html-page.xsl
index 35d8aec..8fa65ce 100644
--- a/xslt/mallard/html/mal2html-page.xsl
+++ b/xslt/mallard/html/mal2html-page.xsl
@@ -644,12 +644,15 @@ templates that handle #{page} and #{section} elements.
 <xsl:template name="mal2html.section">
   <xsl:param name="node" select="."/>
   <div id="{$node/@id}">
-    <xsl:attribute name="class">
-      <xsl:text>sect</xsl:text>
-      <xsl:if test="@ui:expanded or @uix:expanded">
-        <xsl:text> ui-expander</xsl:text>
-      </xsl:if>
-    </xsl:attribute>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="node" select="$node"/>
+      <xsl:with-param name="class">
+        <xsl:text>sect</xsl:text>
+        <xsl:if test="@ui:expanded or @uix:expanded">
+          <xsl:text> ui-expander</xsl:text>
+        </xsl:if>
+      </xsl:with-param>
+    </xsl:call-template>
     <xsl:call-template name="mal2html.ui.expander.data">
       <xsl:with-param name="node" select="$node"/>
     </xsl:call-template>
@@ -831,38 +834,15 @@ templates that handle #{page} and #{section} elements.
 <!--%%==========================================================================
 mal2html.title.mode
 Output headings for titles and subtitles.
-:Revision:version="3.8" date="2012-11-05" status="final"
+:Revision:version="3.10" date="2013-07-10" status="final"
 
 This template is called on #{title} and #{subtitle} elements that appear as
 direct child content of #{page} or #{section} elements. Normal block titles
 are processed in %{mal2html.block.mode}.
 -->
-<!-- = subtitle = -->
-<xsl:template mode="mal2html.title.mode" match="mal:subtitle">
-  <xsl:variable name="depth"
-                select="count(ancestor::mal:section) + 2"/>
-  <xsl:variable name="depth_">
-    <xsl:choose>
-      <xsl:when test="$depth &lt; 6">
-        <xsl:value-of select="$depth"/>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:value-of select="6"/>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:variable>
-  <xsl:element name="{concat('h', $depth_)}" namespace="{$html.namespace}">
-    <xsl:attribute name="class">
-      <xsl:text>subtitle</xsl:text>
-    </xsl:attribute>
-    <xsl:apply-templates mode="mal2html.inline.mode"/>
-  </xsl:element>
-</xsl:template>
-
-<!-- = title = -->
-<xsl:template mode="mal2html.title.mode" match="mal:title">
+<xsl:template mode="mal2html.title.mode" match="mal:title | mal:subtitle">
   <xsl:variable name="depth"
-                select="count(ancestor::mal:section) + 1"/>
+                select="count(ancestor::mal:section) + 1 + boolean(self::mal:subtitle)"/>
   <xsl:variable name="depth_">
     <xsl:choose>
       <xsl:when test="$depth &lt; 6">
@@ -874,10 +854,10 @@ are processed in %{mal2html.block.mode}.
     </xsl:choose>
   </xsl:variable>
   <xsl:element name="{concat('h', $depth_)}" namespace="{$html.namespace}">
-    <xsl:attribute name="class">
-      <xsl:text>title</xsl:text>
-    </xsl:attribute>
-    <span class="title">
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class" select="local-name(.)"/>
+    </xsl:call-template>
+    <span class="{local-name(.)}">
       <xsl:apply-templates mode="mal2html.inline.mode"/>
     </span>
   </xsl:element>
diff --git a/xslt/mallard/html/mal2html-svg.xsl b/xslt/mallard/html/mal2html-svg.xsl
index 9bb2e81..831e47a 100644
--- a/xslt/mallard/html/mal2html-svg.xsl
+++ b/xslt/mallard/html/mal2html-svg.xsl
@@ -99,38 +99,31 @@ certain Mallard extensions, for example to use the Mallard linking mechanism.
       </xsl:otherwise>
     </xsl:choose>
   </xsl:variable>
-  <xsl:choose>
-    <xsl:when test="$html.xhtml">
-      <div>
-        <xsl:attribute name="class">
-          <xsl:text>svg</xsl:text>
-          <xsl:if test="$if != 'true'">
-            <xsl:text> if-if </xsl:text>
-            <xsl:value-of select="$if"/>
-          </xsl:if>
-        </xsl:attribute>
+  <div>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class">
+        <xsl:text>svg</xsl:text>
+        <xsl:if test="$if != 'true'">
+          <xsl:text> if-if </xsl:text>
+          <xsl:value-of select="$if"/>
+        </xsl:if>
+      </xsl:with-param>
+    </xsl:call-template>
+    <xsl:choose>
+      <xsl:when test="$html.xhtml">
         <xsl:apply-templates mode="mal2html.svg.mode" select="."/>
-      </div>
-    </xsl:when>
-    <xsl:otherwise>
-      <div>
-        <xsl:attribute name="class">
-          <xsl:text>svg</xsl:text>
-          <xsl:if test="$if != 'true'">
-            <xsl:text> if-if </xsl:text>
-            <xsl:value-of select="$if"/>
-          </xsl:if>
-        </xsl:attribute>
+      </xsl:when>
+      <xsl:otherwise>
         <object data="{$id}.svg" type="image/svg+xml">
           <xsl:copy-of select="@width"/>
           <xsl:copy-of select="@height"/>
         </object>
-      </div>
-      <exsl:document href="{$id}.svg">
-        <xsl:apply-templates mode="mal2html.svg.mode" select="."/>
-      </exsl:document>
-    </xsl:otherwise>
-  </xsl:choose>
+        <exsl:document href="{$id}.svg">
+          <xsl:apply-templates mode="mal2html.svg.mode" select="."/>
+        </exsl:document>
+      </xsl:otherwise>
+    </xsl:choose>
+  </div>
 </xsl:if>
 </xsl:template>
 
diff --git a/xslt/mallard/html/mal2html-table.xsl b/xslt/mallard/html/mal2html-table.xsl
index 92b201a..33603dc 100644
--- a/xslt/mallard/html/mal2html-table.xsl
+++ b/xslt/mallard/html/mal2html-table.xsl
@@ -166,19 +166,21 @@ REMARK: Describe this module
     </xsl:choose>
   </xsl:variable>
   <div>
-    <xsl:attribute name="class">
-      <xsl:text>table</xsl:text>
-      <xsl:for-each select="str:tokenize(@style)">
-        <xsl:value-of select="concat(' style-', .)"/>
-      </xsl:for-each>
-      <xsl:if test="mal:title and (@ui:expanded or @uix:expanded)">
-        <xsl:text> ui-expander</xsl:text>
-      </xsl:if>
-      <xsl:if test="$if != 'true'">
-        <xsl:text> if-if </xsl:text>
-        <xsl:value-of select="$if"/>
-      </xsl:if>
-    </xsl:attribute>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class">
+        <xsl:text>table</xsl:text>
+        <xsl:for-each select="str:tokenize(@style)">
+          <xsl:value-of select="concat(' style-', .)"/>
+        </xsl:for-each>
+        <xsl:if test="mal:title and (@ui:expanded or @uix:expanded)">
+          <xsl:text> ui-expander</xsl:text>
+        </xsl:if>
+        <xsl:if test="$if != 'true'">
+          <xsl:text> if-if </xsl:text>
+          <xsl:value-of select="$if"/>
+        </xsl:if>
+      </xsl:with-param>
+    </xsl:call-template>
     <xsl:call-template name="mal2html.ui.expander.data"/>
     <div class="inner">
       <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
@@ -226,6 +228,8 @@ REMARK: Describe this module
   <xsl:param name="rowshade"/>
   <xsl:param name="colshade"/>
   <tbody>
+    <xsl:call-template name="html.class.attr"/>
+    <xsl:call-template name="html.lang.attrs"/>
     <xsl:apply-templates select="mal:tr[1]">
       <xsl:with-param name="cols" select="$cols"/>
       <xsl:with-param name="rowrules" select="$rowrules"/>
@@ -244,6 +248,8 @@ REMARK: Describe this module
   <xsl:param name="rowshade"/>
   <xsl:param name="colshade"/>
   <thead>
+    <xsl:call-template name="html.class.attr"/>
+    <xsl:call-template name="html.lang.attrs"/>
     <xsl:apply-templates select="mal:tr[1]">
       <xsl:with-param name="cols" select="$cols"/>
       <xsl:with-param name="rowrules" select="$rowrules"/>
@@ -262,6 +268,8 @@ REMARK: Describe this module
   <xsl:param name="rowshade"/>
   <xsl:param name="colshade"/>
   <tfoot>
+    <xsl:call-template name="html.class.attr"/>
+    <xsl:call-template name="html.lang.attrs"/>
     <xsl:apply-templates select="mal:tr[1]">
       <xsl:with-param name="cols" select="$cols"/>
       <xsl:with-param name="rowrules" select="$rowrules"/>
@@ -316,11 +324,13 @@ REMARK: Describe this module
     </xsl:choose>
   </xsl:variable>
   <tr>
-    <xsl:if test="$shaderow = 1">
-      <xsl:attribute name="class">
-        <xsl:text>shade</xsl:text>
-      </xsl:attribute>
-    </xsl:if>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class">
+        <xsl:if test="$shaderow = 1">
+          <xsl:text>shade</xsl:text>
+        </xsl:if>
+      </xsl:with-param>
+    </xsl:call-template>
     <xsl:apply-templates select="mal:td">
       <xsl:with-param name="cols" select="$cols"/>
       <xsl:with-param name="rowrules" select="$rowrules"/>
@@ -495,11 +505,13 @@ REMARK: Describe this module
     </xsl:choose>
   </xsl:variable>
   <td>
-    <xsl:if test="$shadecol = 1">
-      <xsl:attribute name="class">
-        <xsl:text>shade</xsl:text>
-      </xsl:attribute>
-    </xsl:if>
+    <xsl:call-template name="html.class.attr">
+      <xsl:with-param name="class">
+        <xsl:if test="$shadecol = 1">
+          <xsl:text>shade</xsl:text>
+        </xsl:if>
+      </xsl:with-param>
+    </xsl:call-template>
     <xsl:if test="$style != ''">
       <xsl:attribute name="style">
         <xsl:value-of select="$style"/>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]