From: <bob...@us...> - 2009-03-22 07:51:45
|
Revision: 8370 http://docbook.svn.sourceforge.net/docbook/?rev=8370&view=rev Author: bobstayton Date: 2009-03-22 07:51:29 +0000 (Sun, 22 Mar 2009) Log Message: ----------- Add support fo dbfo keep-together processing instruction to more blocks like list items and paras. Modified Paths: -------------- trunk/xsl/fo/block.xsl trunk/xsl/fo/lists.xsl Modified: trunk/xsl/fo/block.xsl =================================================================== --- trunk/xsl/fo/block.xsl 2009-03-22 07:09:44 UTC (rev 8369) +++ trunk/xsl/fo/block.xsl 2009-03-22 07:51:29 UTC (rev 8370) @@ -23,7 +23,14 @@ <!-- ==================================================================== --> <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> @@ -32,21 +39,42 @@ <!-- ==================================================================== --> <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> @@ -86,7 +114,14 @@ <!-- ==================================================================== --> <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"> @@ -386,7 +421,14 @@ <!-- ==================================================================== --> <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> Modified: trunk/xsl/fo/lists.xsl =================================================================== --- trunk/xsl/fo/lists.xsl 2009-03-22 07:09:44 UTC (rev 8369) +++ trunk/xsl/fo/lists.xsl 2009-03-22 07:51:29 UTC (rev 8370) @@ -27,10 +27,10 @@ <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> @@ -58,18 +58,18 @@ <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> @@ -107,6 +107,10 @@ <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> @@ -137,11 +141,19 @@ <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> @@ -190,10 +202,10 @@ <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> @@ -221,17 +233,17 @@ <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> @@ -241,6 +253,10 @@ <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> @@ -257,11 +273,19 @@ <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> @@ -465,9 +489,14 @@ <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> @@ -482,11 +511,19 @@ <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> @@ -593,7 +630,7 @@ <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> @@ -616,10 +653,10 @@ <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> @@ -674,13 +711,13 @@ <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> @@ -936,7 +973,15 @@ <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 --> @@ -972,7 +1017,15 @@ <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>•</xsl:text> @@ -1143,9 +1196,9 @@ 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 @@ -1160,7 +1213,16 @@ <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"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |