Next in thread → Next in month →

RE: [docbook-apps] Formal titles as a float

From
Skopik Pavel <>
Date
2006-12-11T09:11:24+00:00
ID
Thread
RE: [docbook-apps] Formal titles as a float
Hello,

 

thank you very much for
kind help and sorry for such a late answer. 

 

The exmaple you posted
exatly solved my problem. At the beginning I was trying to make changes just in
this template, but I did not use the „content“ variable which then of
course did not work and so I tried to create a new template. 

 

Customizing simple template
works fine but the solution you provided solves all issues in one place.

 

Again, thanks a lot.

 

Greetings

pavel

 

 

-----Original Message-----

From: Bob Stayton
[mailto:] 

Sent: Tuesday, December 05, 2006
7:38 AM

To: Skopik Pavel;


Subject: Re: [docbook-apps] Formal
titles as a float

 

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
Next in thread → Next in month →