]> granicus.if.org Git - docbook-dsssl/commitdiff
Add support fo dbfo keep-together processing instruction to
authorBob Stayton <bobs@sagehill.net>
Sun, 22 Mar 2009 07:51:29 +0000 (07:51 +0000)
committerBob Stayton <bobs@sagehill.net>
Sun, 22 Mar 2009 07:51:29 +0000 (07:51 +0000)
more blocks like list items and paras.

xsl/fo/block.xsl
xsl/fo/lists.xsl

index f5b6de849af01e0d21d3f976a1dc83c48ec453a2..53e56c304dea71c1a102fdf5474a4af4345ec9fd 100644 (file)
 <!-- ==================================================================== -->
 
 <xsl:template name="block.object">
+  <xsl:variable name="keep.together">
+    <xsl:call-template name="pi.dbfo_keep-together"/>
+  </xsl:variable>
   <fo:block>
+    <xsl:if test="$keep.together != ''">
+      <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                      select="$keep.together"/></xsl:attribute>
+    </xsl:if>
     <xsl:call-template name="anchor"/>
     <xsl:apply-templates/>
   </fo:block>
 <!-- ==================================================================== -->
 
 <xsl:template match="para">
+  <xsl:variable name="keep.together">
+    <xsl:call-template name="pi.dbfo_keep-together"/>
+  </xsl:variable>
   <fo:block xsl:use-attribute-sets="normal.para.spacing">
+    <xsl:if test="$keep.together != ''">
+      <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                      select="$keep.together"/></xsl:attribute>
+    </xsl:if>
     <xsl:call-template name="anchor"/>
     <xsl:apply-templates/>
   </fo:block>
 </xsl:template>
 
 <xsl:template match="simpara">
+  <xsl:variable name="keep.together">
+    <xsl:call-template name="pi.dbfo_keep-together"/>
+  </xsl:variable>
   <fo:block xsl:use-attribute-sets="normal.para.spacing">
+    <xsl:if test="$keep.together != ''">
+      <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                      select="$keep.together"/></xsl:attribute>
+    </xsl:if>
     <xsl:call-template name="anchor"/>
     <xsl:apply-templates/>
   </fo:block>
 </xsl:template>
 
 <xsl:template match="formalpara">
+  <xsl:variable name="keep.together">
+    <xsl:call-template name="pi.dbfo_keep-together"/>
+  </xsl:variable>
   <fo:block xsl:use-attribute-sets="normal.para.spacing">
+    <xsl:if test="$keep.together != ''">
+      <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                      select="$keep.together"/></xsl:attribute>
+    </xsl:if>
     <xsl:call-template name="anchor"/>
     <xsl:apply-templates/>
   </fo:block>
 <!-- ==================================================================== -->
 
 <xsl:template match="blockquote">
+  <xsl:variable name="keep.together">
+    <xsl:call-template name="pi.dbfo_keep-together"/>
+  </xsl:variable>
   <fo:block xsl:use-attribute-sets="blockquote.properties">
+    <xsl:if test="$keep.together != ''">
+      <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                      select="$keep.together"/></xsl:attribute>
+    </xsl:if>
     <xsl:call-template name="anchor"/>
     <fo:block>
       <xsl:if test="title|info/title">
 <!-- ==================================================================== -->
 
 <xsl:template match="abstract">
+  <xsl:variable name="keep.together">
+    <xsl:call-template name="pi.dbfo_keep-together"/>
+  </xsl:variable>
   <fo:block xsl:use-attribute-sets="abstract.properties">
+    <xsl:if test="$keep.together != ''">
+      <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                      select="$keep.together"/></xsl:attribute>
+    </xsl:if>
     <xsl:call-template name="anchor"/>
     <xsl:apply-templates/>
   </fo:block>
index ba099b86d9a21469f193bf07b5c3576dc9249dd7..717a48e5188472a68e8a840133dbc82a43b8dee8 100644 (file)
   <xsl:variable name="label-width">
     <xsl:choose>
       <xsl:when test="$pi-label-width = ''">
-       <xsl:value-of select="$itemizedlist.label.width"/>
+        <xsl:value-of select="$itemizedlist.label.width"/>
       </xsl:when>
       <xsl:otherwise>
-       <xsl:value-of select="$pi-label-width"/>
+        <xsl:value-of select="$pi-label-width"/>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:variable>
   <xsl:choose>
     <xsl:when test="ancestor::listitem">
       <fo:list-block id="{$id}" xsl:use-attribute-sets="itemizedlist.properties">
-       <xsl:attribute name="provisional-distance-between-starts">
-         <xsl:value-of select="$label-width"/>
-       </xsl:attribute>
+        <xsl:attribute name="provisional-distance-between-starts">
+          <xsl:value-of select="$label-width"/>
+        </xsl:attribute>
         <xsl:copy-of select="$content"/>
       </fo:list-block>
     </xsl:when>
     <xsl:otherwise>
       <fo:list-block id="{$id}" xsl:use-attribute-sets="list.block.spacing itemizedlist.properties">
-       <xsl:attribute name="provisional-distance-between-starts">
-         <xsl:value-of select="$label-width"/>
-       </xsl:attribute>
-       <xsl:copy-of select="$content"/>
+        <xsl:attribute name="provisional-distance-between-starts">
+          <xsl:value-of select="$label-width"/>
+        </xsl:attribute>
+        <xsl:copy-of select="$content"/>
       </fo:list-block>
     </xsl:otherwise>
   </xsl:choose>
 <xsl:template match="itemizedlist/listitem">
   <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
 
+  <xsl:variable name="keep.together">
+    <xsl:call-template name="pi.dbfo_keep-together"/>
+  </xsl:variable>
+
   <xsl:variable name="item.contents">
     <fo:list-item-label end-indent="label-end()" xsl:use-attribute-sets="itemizedlist.label.properties">
       <fo:block>
   <xsl:choose>
     <xsl:when test="parent::*/@spacing = 'compact'">
       <fo:list-item id="{$id}" xsl:use-attribute-sets="compact.list.item.spacing">
+        <xsl:if test="$keep.together != ''">
+          <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                          select="$keep.together"/></xsl:attribute>
+        </xsl:if>
         <xsl:copy-of select="$item.contents"/>
       </fo:list-item>
     </xsl:when>
     <xsl:otherwise>
       <fo:list-item id="{$id}" xsl:use-attribute-sets="list.item.spacing">
+        <xsl:if test="$keep.together != ''">
+          <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                          select="$keep.together"/></xsl:attribute>
+        </xsl:if>
         <xsl:copy-of select="$item.contents"/>
       </fo:list-item>
     </xsl:otherwise>
   <xsl:variable name="label-width">
     <xsl:choose>
       <xsl:when test="$pi-label-width = ''">
-       <xsl:value-of select="$orderedlist.label.width"/>
+        <xsl:value-of select="$orderedlist.label.width"/>
       </xsl:when>
       <xsl:otherwise>
-       <xsl:value-of select="$pi-label-width"/>
+        <xsl:value-of select="$pi-label-width"/>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:variable>
   <xsl:choose>
     <xsl:when test="ancestor::listitem">
       <fo:list-block id="{$id}" xsl:use-attribute-sets="orderedlist.properties">
-       <xsl:attribute name="provisional-distance-between-starts">
-         <xsl:value-of select="$label-width"/>
-       </xsl:attribute>
+        <xsl:attribute name="provisional-distance-between-starts">
+          <xsl:value-of select="$label-width"/>
+        </xsl:attribute>
         <xsl:copy-of select="$content"/>
       </fo:list-block>
     </xsl:when>
     <xsl:otherwise>
       <fo:list-block id="{$id}" xsl:use-attribute-sets="list.block.spacing orderedlist.properties">
-       <xsl:attribute name="provisional-distance-between-starts">
-         <xsl:value-of select="$label-width"/>
-       </xsl:attribute>
+        <xsl:attribute name="provisional-distance-between-starts">
+          <xsl:value-of select="$label-width"/>
+        </xsl:attribute>
         <xsl:copy-of select="$content"/>
       </fo:list-block>
     </xsl:otherwise>
 <xsl:template match="orderedlist/listitem">
   <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
 
+  <xsl:variable name="keep.together">
+    <xsl:call-template name="pi.dbfo_keep-together"/>
+  </xsl:variable>
+
   <xsl:variable name="item.contents">
     <fo:list-item-label end-indent="label-end()" xsl:use-attribute-sets="orderedlist.label.properties">
       <fo:block>
   <xsl:choose>
     <xsl:when test="parent::*/@spacing = 'compact'">
       <fo:list-item id="{$id}" xsl:use-attribute-sets="compact.list.item.spacing">
+        <xsl:if test="$keep.together != ''">
+          <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                          select="$keep.together"/></xsl:attribute>
+        </xsl:if>
         <xsl:copy-of select="$item.contents"/>
       </fo:list-item>
     </xsl:when>
     <xsl:otherwise>
       <fo:list-item id="{$id}" xsl:use-attribute-sets="list.item.spacing">
+        <xsl:if test="$keep.together != ''">
+          <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                          select="$keep.together"/></xsl:attribute>
+        </xsl:if>
         <xsl:copy-of select="$item.contents"/>
       </fo:list-item>
     </xsl:otherwise>
   <xsl:variable name="id">
     <xsl:call-template name="object.id"/>
   </xsl:variable>
+
+  <xsl:variable name="keep.together">
+    <xsl:call-template name="pi.dbfo_keep-together"/>
+  </xsl:variable>
+
   <xsl:variable name="item.contents">
     <fo:list-item-label end-indent="label-end()" text-align="start">
-      <fo:block xsl:-use-attribute-sets="variablelist.term.properties">
+      <fo:block xsl:use-attribute-sets="variablelist.term.properties">
         <xsl:apply-templates select="term"/>
       </fo:block>
     </fo:list-item-label>
     <xsl:when test="parent::*/@spacing = 'compact'">
       <fo:list-item id="{$id}"
           xsl:use-attribute-sets="compact.list.item.spacing">
+        <xsl:if test="$keep.together != ''">
+          <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                          select="$keep.together"/></xsl:attribute>
+        </xsl:if>
         <xsl:copy-of select="$item.contents"/>
       </fo:list-item>
     </xsl:when>
     <xsl:otherwise>
       <fo:list-item id="{$id}" xsl:use-attribute-sets="list.item.spacing">
+        <xsl:if test="$keep.together != ''">
+          <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                          select="$keep.together"/></xsl:attribute>
+        </xsl:if>
         <xsl:copy-of select="$item.contents"/>
       </fo:list-item>
     </xsl:otherwise>
   <xsl:variable name="explicit.table.width">
     <xsl:call-template name="dbfo-attribute">
       <xsl:with-param name="pis"
-                     select="processing-instruction('dbfo')"/>
+                      select="processing-instruction('dbfo')"/>
       <xsl:with-param name="attribute" select="'list-width'"/>
     </xsl:call-template>
   </xsl:variable>
 
     <xsl:choose>
       <xsl:when test="$axf.extensions != 0 or $xep.extensions != 0">
-       <xsl:attribute name="table-layout">auto</xsl:attribute>
+        <xsl:attribute name="table-layout">auto</xsl:attribute>
         <xsl:if test="$explicit.table.width != ''">
           <xsl:attribute name="width"><xsl:value-of 
-         select="$explicit.table.width"/></xsl:attribute>
+          select="$explicit.table.width"/></xsl:attribute>
         </xsl:if>
       </xsl:when>
       <xsl:otherwise>
     <xsl:choose>
       <xsl:when test="position() = last()"/> <!-- do nothing -->
       <xsl:otherwise>
-       <xsl:text>, </xsl:text>
-       <xsl:if test="position() = last() - 1">
-         <xsl:if test="$localized-choice-separator != ''">
-           <xsl:value-of select="$localized-choice-separator"/>
-           <xsl:text> </xsl:text>
-         </xsl:if>
-       </xsl:if>
+        <xsl:text>, </xsl:text>
+        <xsl:if test="position() = last() - 1">
+          <xsl:if test="$localized-choice-separator != ''">
+            <xsl:value-of select="$localized-choice-separator"/>
+            <xsl:text> </xsl:text>
+          </xsl:if>
+        </xsl:if>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:for-each></fo:inline>
     <xsl:call-template name="object.id"/>
   </xsl:variable>
 
+  <xsl:variable name="keep.together">
+    <xsl:call-template name="pi.dbfo_keep-together"/>
+  </xsl:variable>
+
   <fo:list-item xsl:use-attribute-sets="list.item.spacing">
+    <xsl:if test="$keep.together != ''">
+      <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                      select="$keep.together"/></xsl:attribute>
+    </xsl:if>
     <fo:list-item-label end-indent="label-end()">
       <fo:block id="{$id}">
         <!-- dwc: fix for one step procedures. Use a bullet if there's no step 2 -->
     <xsl:call-template name="object.id"/>
   </xsl:variable>
 
+  <xsl:variable name="keep.together">
+    <xsl:call-template name="pi.dbfo_keep-together"/>
+  </xsl:variable>
+
   <fo:list-item xsl:use-attribute-sets="list.item.spacing">
+    <xsl:if test="$keep.together != ''">
+      <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                      select="$keep.together"/></xsl:attribute>
+    </xsl:if>
     <fo:list-item-label end-indent="label-end()">
       <fo:block id="{$id}">
         <xsl:text>&#x2022;</xsl:text>
                    provisional-label-separation="0.2em">
 
       <xsl:if test="$pi-label-width != ''">
-       <xsl:attribute name="provisional-distance-between-starts">
-         <xsl:value-of select="$pi-label-width"/>
-       </xsl:attribute>
+              <xsl:attribute name="provisional-distance-between-starts">
+          <xsl:value-of select="$pi-label-width"/>
+        </xsl:attribute>
       </xsl:if>
       
       <xsl:apply-templates select="callout
 
 <xsl:template match="callout">
   <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
+
+  <xsl:variable name="keep.together">
+    <xsl:call-template name="pi.dbfo_keep-together"/>
+  </xsl:variable>
+
   <fo:list-item id="{$id}">
+    <xsl:if test="$keep.together != ''">
+      <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                      select="$keep.together"/></xsl:attribute>
+    </xsl:if>
     <fo:list-item-label end-indent="label-end()">
       <fo:block>
         <xsl:call-template name="callout.arearefs">