]> granicus.if.org Git - docbook-dsssl/commitdiff
Complete support for <?dbfo pgwide="1"?> for informal
authorBob Stayton <bobs@sagehill.net>
Fri, 14 Sep 2007 22:14:55 +0000 (22:14 +0000)
committerBob Stayton <bobs@sagehill.net>
Fri, 14 Sep 2007 22:14:55 +0000 (22:14 +0000)
elements too.

xsl/fo/formal.xsl

index 0233d79f38e3b20cbd2194003d97210573a40f20..c9d9ef3034606b614c1e5fca34e7c2b06154defe 100644 (file)
     <xsl:call-template name="pi.dbfo_keep-together"/>
   </xsl:variable>
 
+  <!-- These don't have a pgwide attribute, so may use a PI -->
+  <xsl:variable name="pgwide.pi">
+    <xsl:call-template name="pi.dbfo_pgwide"/>
+  </xsl:variable>
+
+  <xsl:variable name="pgwide">
+    <xsl:choose>
+      <xsl:when test="$pgwide.pi">
+        <xsl:value-of select="$pgwide.pi"/>
+      </xsl:when>
+      <!-- child element may set pgwide -->
+      <xsl:when test="*[@pgwide]">
+        <xsl:value-of select="*[@pgwide][1]/@pgwide"/>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:variable>
+
   <xsl:choose>
     <!-- informaltables have their own templates and 
          are not handled by formal.object -->
     <xsl:when test="local-name(.) = 'equation'">
-      <fo:block id="{$id}"
-                xsl:use-attribute-sets="equation.properties">
-        <xsl:if test="$keep.together != ''">
-          <xsl:attribute name="keep-together.within-column"><xsl:value-of
-                          select="$keep.together"/></xsl:attribute>
-        </xsl:if>
-        <xsl:apply-templates/>
-      </fo:block>
+      <xsl:choose>
+        <xsl:when test="$pgwide = '1'">
+          <fo:block id="{$id}"
+                    xsl:use-attribute-sets="pgwide.properties
+                                            equation.properties">
+            <xsl:if test="$keep.together != ''">
+              <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                              select="$keep.together"/></xsl:attribute>
+            </xsl:if>
+            <xsl:apply-templates/>
+          </fo:block>
+        </xsl:when>
+        <xsl:otherwise>
+          <fo:block id="{$id}"
+                    xsl:use-attribute-sets="equation.properties">
+            <xsl:if test="$keep.together != ''">
+              <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                              select="$keep.together"/></xsl:attribute>
+            </xsl:if>
+            <xsl:apply-templates/>
+          </fo:block>
+        </xsl:otherwise>
+      </xsl:choose>
     </xsl:when>
     <xsl:when test="local-name(.) = 'procedure'">
       <fo:block id="{$id}"
       </fo:block>
     </xsl:when>
     <xsl:when test="local-name(.) = 'informalfigure'">
-      <fo:block id="{$id}"
-                xsl:use-attribute-sets="informalfigure.properties">
-        <xsl:if test="$keep.together != ''">
-          <xsl:attribute name="keep-together.within-column"><xsl:value-of
-                          select="$keep.together"/></xsl:attribute>
-        </xsl:if>
-        <xsl:apply-templates/>
-      </fo:block>
+      <xsl:choose>
+        <xsl:when test="$pgwide = '1'">
+          <fo:block id="{$id}"
+                    xsl:use-attribute-sets="pgwide.properties
+                                            informalfigure.properties">
+            <xsl:if test="$keep.together != ''">
+              <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                              select="$keep.together"/></xsl:attribute>
+            </xsl:if>
+            <xsl:apply-templates/>
+          </fo:block>
+        </xsl:when>
+        <xsl:otherwise>
+          <fo:block id="{$id}"
+                    xsl:use-attribute-sets="informalfigure.properties">
+            <xsl:if test="$keep.together != ''">
+              <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                              select="$keep.together"/></xsl:attribute>
+            </xsl:if>
+            <xsl:apply-templates/>
+          </fo:block>
+        </xsl:otherwise>
+      </xsl:choose>
     </xsl:when>
     <xsl:when test="local-name(.) = 'informalexample'">
-      <fo:block id="{$id}"
-                xsl:use-attribute-sets="informalexample.properties">
-        <xsl:if test="$keep.together != ''">
-          <xsl:attribute name="keep-together.within-column"><xsl:value-of
-                          select="$keep.together"/></xsl:attribute>
-        </xsl:if>
-        <xsl:apply-templates/>
-      </fo:block>
+      <xsl:choose>
+        <xsl:when test="$pgwide = '1'">
+          <fo:block id="{$id}"
+                    xsl:use-attribute-sets="pgwide.properties
+                                            informalexample.properties">
+            <xsl:if test="$keep.together != ''">
+              <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                              select="$keep.together"/></xsl:attribute>
+            </xsl:if>
+            <xsl:apply-templates/>
+          </fo:block>
+        </xsl:when>
+        <xsl:otherwise>
+          <fo:block id="{$id}"
+                    xsl:use-attribute-sets="informalexample.properties">
+            <xsl:if test="$keep.together != ''">
+              <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                              select="$keep.together"/></xsl:attribute>
+            </xsl:if>
+            <xsl:apply-templates/>
+          </fo:block>
+        </xsl:otherwise>
+      </xsl:choose>
     </xsl:when>
     <xsl:when test="local-name(.) = 'informalequation'">
-      <fo:block id="{$id}"
-                xsl:use-attribute-sets="informalequation.properties">
-        <xsl:apply-templates/>
-      </fo:block>
+      <xsl:choose>
+        <xsl:when test="$pgwide = '1'">
+          <fo:block id="{$id}"
+                    xsl:use-attribute-sets="pgwide.properties
+                                            informalequation.properties">
+            <xsl:if test="$keep.together != ''">
+              <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                              select="$keep.together"/></xsl:attribute>
+            </xsl:if>
+            <xsl:apply-templates/>
+          </fo:block>
+        </xsl:when>
+        <xsl:otherwise>
+          <fo:block id="{$id}"
+                    xsl:use-attribute-sets="informalequation.properties">
+            <xsl:if test="$keep.together != ''">
+              <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                              select="$keep.together"/></xsl:attribute>
+            </xsl:if>
+            <xsl:apply-templates/>
+          </fo:block>
+        </xsl:otherwise>
+      </xsl:choose>
     </xsl:when>
     <xsl:otherwise>
       <fo:block id="{$id}"