[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] single column title page and two-column body on same pdf page
Hi Brett,
Yes, it is possible to get the layout you want with the DocBook XSL
stylesheets and fop.0.92. You want to set the column-count for the
page-master to 2, and then add a span="all" property to fo:block that
contains your titlepage content. Then your titlepage info will span the
page, and the rest of the content will switch to two-column on the same
page.
The trick is to get the span="all" into the outermost fo:block, because it
doesn't work if the spanned fo:block is not a direct child of the fo:flow.
That requires a customization of the match="article" template from
fo/component.xsl.
In the following customization, various parameters are set, and the article
template is changed only to add the span="all" property (just search for
it) on the titlepage block.
I also use a customization of abstract to add
space-after.conditionality="retain" to it. In the transition from
one-column to two-column layout, the reference area is reset, so the
normal space-after of the abstract is ignored by default. That means there
is no space between the bottom of the abstract and the top of the
two-column text. Using "retain" retains the space. You'll need to do
that to the last item in your titlepage information.
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
version='1.0'>
<xsl:import href="../docbook-xsl-1.71.0/fo/docbook.xsl"/>
<xsl:output indent="no"/>
<xsl:param name="column.count.body">2</xsl:param>
<xsl:param name="fop1.extensions">1</xsl:param>
<xsl:param name="title.margin.left">0pt</xsl:param>
<xsl:param name="body.start.indent">0pt</xsl:param>
<xsl:param name="generate.toc">
article nop
</xsl:param>
<xsl:template match="article">
<xsl:variable name="id">
<xsl:call-template name="object.id"/>
</xsl:variable>
<xsl:variable name="master-reference">
<xsl:call-template name="select.pagemaster"/>
</xsl:variable>
<fo:page-sequence hyphenate="{$hyphenate}"
master-reference="{$master-reference}">
<xsl:attribute name="language">
<xsl:call-template name="l10n.language"/>
</xsl:attribute>
<xsl:attribute name="format">
<xsl:call-template name="page.number.format">
<xsl:with-param name="master-reference"
select="$master-reference"/>
</xsl:call-template>
</xsl:attribute>
<xsl:attribute name="initial-page-number">
<xsl:call-template name="initial.page.number">
<xsl:with-param name="master-reference"
select="$master-reference"/>
</xsl:call-template>
</xsl:attribute>
<xsl:attribute name="force-page-count">
<xsl:call-template name="force.page.count">
<xsl:with-param name="master-reference"
select="$master-reference"/>
</xsl:call-template>
</xsl:attribute>
<xsl:attribute name="hyphenation-character">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'hyphenation-character'"/>
</xsl:call-template>
</xsl:attribute>
<xsl:attribute name="hyphenation-push-character-count">
<xsl:call-template name="gentext">
<xsl:with-param name="key"
select="'hyphenation-push-character-count'"/>
</xsl:call-template>
</xsl:attribute>
<xsl:attribute name="hyphenation-remain-character-count">
<xsl:call-template name="gentext">
<xsl:with-param name="key"
select="'hyphenation-remain-character-count'"/>
</xsl:call-template>
</xsl:attribute>
<xsl:apply-templates select="." mode="running.head.mode">
<xsl:with-param name="master-reference" select="$master-reference"/>
</xsl:apply-templates>
<xsl:apply-templates select="." mode="running.foot.mode">
<xsl:with-param name="master-reference" select="$master-reference"/>
</xsl:apply-templates>
<fo:flow flow-name="xsl-region-body">
<xsl:call-template name="set.flow.properties">
<xsl:with-param name="element" select="local-name(.)"/>
<xsl:with-param name="master-reference"
select="$master-reference"/>
</xsl:call-template>
<fo:block id="{$id}" span="all">
<xsl:call-template name="article.titlepage"/>
</fo:block>
<xsl:variable name="toc.params">
<xsl:call-template name="find.path.params">
<xsl:with-param name="table"
select="normalize-space($generate.toc)"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="contains($toc.params, 'toc')">
<xsl:call-template name="component.toc">
<xsl:with-param name="toc.title.p"
select="contains($toc.params, 'title')"/>
</xsl:call-template>
<xsl:call-template name="component.toc.separator"/>
</xsl:if>
<xsl:apply-templates/>
</fo:flow>
</fo:page-sequence>
</xsl:template>
<xsl:template match="abstract" mode="titlepage.mode">
<fo:block space-after.conditionality="retain" space-after="14pt">
<xsl:call-template name="formal.object.heading">
<xsl:with-param name="title">
<xsl:apply-templates select="." mode="title.markup"/>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates mode="titlepage.mode"/>
</fo:block>
</xsl:template>
</xsl:stylesheet>
Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobs@sagehill.net
----- Original Message -----
From: "Brett Gossage" <bgossage@invariant-corp.com>
To: <docbook-apps@lists.oasis-open.org>
Sent: Sunday, October 01, 2006 6:00 PM
Subject: [docbook-apps] single column title page and two-column body on
same pdf page
> Technical articles often require two-column format with the title and
> abstract on the first page. With no page break between.
>
> I have a customization layer for pdf output that provides all the content
> and formatting to the get the title, abstract, and body in the format
> required. The page break remains unsolved. After considerable digging, in
> appears the title page and body are always generated in separate
> page-sequences which are required to generate page breaks in xsl:fo. My
> attempts to modify the templates to put them in the same page sequence
> result in fop (0.92) errors.
>
> IMO: Forcing all the content of an article into the "body" page master
> seems
> too rigid. It would be nice to be able to have a stand-alone <article>
> and
> set the column format for the title section <articleinfo> and body
> separately. What's required above is really formatting for the <bookinfo>
> not a title page.
>
> TIA
>
> Brett Gossage
>
> Invariant Corp
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
>
>
>
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]