Hello,
As you discovered, when you use xsl:apply-imports,
it applies the default template with match="task" in fo/task.xsl, which
calls formal.object.heading, which duplicates your use of the same
template. You could customize the match="task" template to remove the call
to formal.object.heading, or you could customize formal.object.heading to do
something different for task and lists. Something like this:
<xsl:template
name="formal.object.heading">
<xsl:param name="object"
select="."/>
<xsl:param name="placement"
select="'before'"/>
<xsl:variable
name="content">
<fo:block
xsl:use-attribute-sets="formal.title.properties">
<xsl:choose>
<xsl:when
test="$placement =
'before'">
<xsl:attribute
name="keep-with-next.within-column">always</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute
name="keep-with-previous.within-column">always</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates
select="$object"
mode="object.title.markup">
<xsl:with-param name="allow-anchors"
select="1"/>
</xsl:apply-templates>
</fo:block>
</xsl:variable>
<xsl:choose>
<xsl:when test="$object/self::task or $object/self::orderedlist or
$object/self::itemizedlist">
<xsl:call-template
name="floater">
<xsl:with-param
name="position">left</xsl:with-param>
<xsl:with-param
name="width">0.7in</xsl:with-param>
<xsl:with-param
name="start.indent">0in</xsl:with-param>
<xsl:with-param
name="content">
<fo:block margin-top="1em"
text-align="left"
padding="3pt">
<xsl:copy-of
select="$content"/>
</fo:block>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$content"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
This first formats the title into a
$content variable, and then uses an xsl:choose statement to put that
$content into a float or not, depending on the $object being
processed.
Bob Stayton
Sagehill Enterprises
DocBook Consulting
----- Original Message -----
From:
Skopik
Pavel
To:
Sent: Monday, December 04, 2006 1:22
AM
Subject: [docbook-apps] Formal titles as
a float
Hello,
I have been trying to format
formal titles (for itemizedlist, orderedlist and task) as a float so that it
is easier for a user to scan the text. I would like the float to be on the
left side.
I used Bob
Stayton’s
example for floating admonitions as a starting point and changed the template
to task… The float gets generated, however, the problem is that the title is
generated twice – once as a side float on the left and second as if no float
was used. The only thing I am not able to solve now is to turn off generating
the title above task, itemizedlist etc.
Here is what I have done so far
in my customization layer. I call the template „formal.object.heading“ and I
tried to apply templates with „title markup mode“ as well but I still get the
same result.
<xsl:param
name="body.start.indent">2cm</xsl:param>
<xsl:param
name="xep.extensions" select="'1'"></xsl:param>
<xsl:template match="task |
itemizedlist | orderedlist">
<xsl:call-template name="floater">
<xsl:with-param
name="position">left</xsl:with-param>
<xsl:with-param
name="width">0.7in</xsl:with-param>
<xsl:with-param
name="start.indent">0in</xsl:with-param>
<xsl:with-param name="content">
<fo:block margin-top="1em" text-align="left"
padding="3pt">
<xsl:call-template
name="formal.object.heading"></xsl:call-template>
</fo:block>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-imports/>
</xsl:template>
Could anyone provide me with a
few tips what I am doing wrong? Thank you very much.
Greetings
pavel