]> granicus.if.org Git - docbook-dsssl/commitdiff
Bug #497603: fixed and added default.float.class
authorNorman Walsh <ndw@nwalsh.com>
Fri, 27 Sep 2002 12:32:20 +0000 (12:32 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Fri, 27 Sep 2002 12:32:20 +0000 (12:32 +0000)
xsl/fo/formal.xsl
xsl/html/formal.xsl
xsl/params/default.float.class.xml [new file with mode: 0644]

index 6fc14ea4de317bdfbe9698cff07bae364fa7a97c..9af65fbd0910c2309df803e274321c3f91977876 100644 (file)
     </xsl:choose>
   </xsl:variable>
 
-  <!-- FIXME: is this too careless? -->
-  <xsl:choose>
-    <xsl:when test=".//imagedata[@align][1]">
-      <fo:block text-align="{.//imagedata[@align][1]/@align}">
+  <xsl:variable name="figure">
+    <!-- FIXME: is this too careless? -->
+    <xsl:choose>
+      <xsl:when test=".//imagedata[@align][1]">
+        <fo:block text-align="{.//imagedata[@align][1]/@align}">
+          <xsl:call-template name="formal.object">
+            <xsl:with-param name="placement" select="$placement"/>
+          </xsl:call-template>
+        </fo:block>
+      </xsl:when>
+      <xsl:otherwise>
         <xsl:call-template name="formal.object">
           <xsl:with-param name="placement" select="$placement"/>
         </xsl:call-template>
-      </fo:block>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="@float and @float != 0">
+      <fo:float>
+        <xsl:attribute name="float">
+          <xsl:choose>
+            <xsl:when test="@float = 1">
+              <xsl:value-of select="$default.float.class"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:value-of select="@float"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:attribute>
+        <xsl:copy-of select="$figure"/>
+      </fo:float>
     </xsl:when>
     <xsl:otherwise>
-      <xsl:call-template name="formal.object">
-        <xsl:with-param name="placement" select="$placement"/>
-      </xsl:call-template>
+      <xsl:copy-of select="$figure"/>
     </xsl:otherwise>
   </xsl:choose>
 </xsl:template>
index 4267412ee95cbae83a07d6d19086953005569b8f..74a0e0760b48ee2bd3cc52a07d2600b3464b7fd8 100644 (file)
   </xsl:choose>
 </xsl:template>
 
-<xsl:template match="figure|table|example">
+<xsl:template match="figure">
+  <xsl:variable name="param.placement"
+                select="substring-after(normalize-space($formal.title.placement),
+                                        concat(local-name(.), ' '))"/>
+
+  <xsl:variable name="placement">
+    <xsl:choose>
+      <xsl:when test="contains($param.placement, ' ')">
+        <xsl:value-of select="substring-before($param.placement, ' ')"/>
+      </xsl:when>
+      <xsl:when test="$param.placement = ''">before</xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$param.placement"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="@float and @float != 0">
+      <xsl:variable name="float">
+        <xsl:choose>
+          <xsl:when test="@float = 1">
+            <xsl:value-of select="$default.float.class"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="@float"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:variable>
+
+      <div class="figure-float">
+        <xsl:if test="$float = 'left' or $float = 'right'">
+          <xsl:attribute name="style">
+            <xsl:text>float: </xsl:text>
+            <xsl:value-of select="$float"/>
+            <xsl:text>;</xsl:text>
+          </xsl:attribute>
+        </xsl:if>
+        <xsl:call-template name="formal.object">
+          <xsl:with-param name="placement" select="$placement"/>
+        </xsl:call-template>
+      </div>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:call-template name="formal.object">
+        <xsl:with-param name="placement" select="$placement"/>
+      </xsl:call-template>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="table|example">
   <xsl:variable name="param.placement"
                 select="substring-after(normalize-space($formal.title.placement),
                                         concat(local-name(.), ' '))"/>
diff --git a/xsl/params/default.float.class.xml b/xsl/params/default.float.class.xml
new file mode 100644 (file)
index 0000000..fc66a29
--- /dev/null
@@ -0,0 +1,22 @@
+<refentry id="default.float.class">
+<refmeta>
+<refentrytitle>default.float.class</refentrytitle>
+<refmiscinfo role="type">string</refmiscinfo>
+</refmeta>
+<refnamediv>
+<refname>default.float.class</refname>
+<refpurpose>Specifies the default float class</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv>
+<src:fragment id='default.float.class.frag'>
+<xsl:param name="default.float.class" select="'before'"/>
+</src:fragment>
+</refsynopsisdiv>
+
+<refsect1><title>Description</title>
+
+<para>FIXME:</para>
+
+</refsect1>
+</refentry>