]> granicus.if.org Git - docbook-dsssl/commitdiff
Added a <div class="{$class}-contents"> wrapper around output of
authorMichael Smith <xmldoc@users.sourceforge.net>
Mon, 21 Nov 2005 09:40:40 +0000 (09:40 +0000)
committerMichael Smith <xmldoc@users.sourceforge.net>
Mon, 21 Nov 2005 09:40:40 +0000 (09:40 +0000)
contents of all formal objects. Also, added an optional
<br class="{class}-break"/> linebreak after all formal objects.

WARNING: Because this change places an additional DIV between the
DIV wrapper for the equation and the equation contents, it may
break some existing CSS stylesheets that have been created with
the assumption that there would never be an intervening DIV there.

The following is an example of what Equation output looks like as
a result of the changes described above.

  <div class="equation">
    <a name="three" id="three"></a>

    <p class="title"><b>(1.3)</b></p>

    <div class="equation-contents">
      <span class="mathphrase">1+1=3</span>
    </div>
  </div><br class="equation-break">

Rationale: These changes allow CSS control of the placement of the
formal-object title relative to the formal-object contents. For
example, using the CSS "float" property enables the title and
contents to be rendered on the same line. Example stylesheet:

  .equation {
    margin-top: 20px;
    margin-bottom: 20px;
  }
  .equation-contents {
    float: left;
  }

  .equation .title {
    margin-top: 0;
    float: right;
    margin-right: 200px;
  }

  .equation .title b {
    font-weight: normal;
  }

  .equation-break {
    clear: both;
  }

Note that the purpose of the ".equation-break" class is to provide
a way to clear off the floats.

If you want to instead have the equation title rendered to the left
of the equation contents, you can do something like this:

  .equation {
    margin-top: 20px;
    width: 300px;
    margin-bottom: 20px;
  }
  .equation-contents {
    float: right;
  }

  .equation .title {
    margin-top: 0;
    float: left;
    margin-right: 200px;
  }

  .equation .title b {
    font-weight: normal;
  }

  .equation-break {
    clear: both;
  }

xsl/html/formal.xsl

index 0bf5fb9866771fa6f9da94b6be9b293dcefc8c5e..8899efc36e0302425c8d9a3d60c23e083ad514eb 100644 (file)
@@ -12,6 +12,8 @@
 
      ******************************************************************** -->
 
+<xsl:param name="formal.object.break.after">1</xsl:param>
+
 <xsl:template name="formal.object">
   <xsl:param name="placement" select="'before'"/>
   <xsl:param name="class" select="local-name(.)"/>
@@ -26,8 +28,9 @@
     <xsl:choose>
       <xsl:when test="$placement = 'before'">
         <xsl:call-template name="formal.object.heading"/>
-        <xsl:apply-templates/>
-
+        <div class="{$class}-contents">
+          <xsl:apply-templates/>
+        </div>
         <!-- HACK: This doesn't belong inside formal.object; it should be done by -->
         <!-- the table template, but I want the link to be inside the DIV, so... -->
         <xsl:if test="local-name(.) = 'table'">
@@ -38,8 +41,7 @@
       </xsl:when>
       <xsl:otherwise>
         <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
-        <xsl:apply-templates/>
-
+        <div class="{$class}-contents"><xsl:apply-templates/></div>
         <!-- HACK: This doesn't belong inside formal.object; it should be done by -->
         <!-- the table template, but I want the link to be inside the DIV, so... -->
         <xsl:if test="local-name(.) = 'table'">
@@ -50,6 +52,9 @@
       </xsl:otherwise>
     </xsl:choose>
   </div>
+  <xsl:if test="not($formal.object.break.after = '0')">
+    <br class="{$class}-break"/>
+  </xsl:if>
 </xsl:template>
 
 <xsl:template name="formal.object.heading">