Next in thread → Next in month →

RE: [docbook-apps] section title customization

From
Skopik Pavel <>
Date
2006-04-10T06:49:56+00:00
ID
Thread
RE: [docbook-apps] section title customization
Hi,

 

Thank you very much
for your answer. It gave me
a really good starting point. And eventually it was quite
easy opposed to what it seemed
like at the
beginning J.

 

When loooking at the stylesheets I took a little different
approach than you adviced and
instead of merging those two
templates I just enwraped the content
of  <xsl:variable name="title"> with the suggested fo:list
block element and added proper formatting attributes. Then the titles where
generated as I wanted them to.

 

<xsl:template match="section/title

    |simplesect/title

    |sect1/title

    |sect2/title

    |sect3/title

    |sect4/title

    |sect5/title"

    mode="titlepage.mode"

    priority="2">

 

…

 

<xsl:variable name="title">

        <fo:list-block provisional-distance-between-starts="3cm" provisional-label-separation="1cm">

         
<fo:list-item>

           
<fo:list-item-label start-indent="0cm"
end-indent=“label-end()“>

             
<fo:block>

<xsl:apply-templates select="$section" mode="label.markup">

<xsl:with-param name="allow-anchors" select="1"/>

</xsl:apply-templates>

</fo:block>

           
</fo:list-item-label>

           
<fo:list-item-body
text-align="left"
start-indent="4cm" end-indent="0cm">

             
<fo:block>

<xsl:apply-templates select="$section" mode="title.markup">

<xsl:with-param name="allow-anchors" select="1"/>

</xsl:apply-templates>

</fo:block>

           
</fo:list-item-body>

         
</fo:list-item>

       
</fo:list-block>

      </xsl:variable>

 

….

 

</xsl:template>

 

Again, thanks for help.

 

Pavel Skopik

 

 

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

From: Bob Stayton
[mailto:] 

Sent: Friday, April 07, 2006 5:42
AM

To: Skopik Pavel;


Subject: Re: [docbook-apps]
section title customization

 

Hi,

Sorry for the delay in answering,
but I couldn't find my example.  It turns out it is in a stylesheet I
created for a client, so I can't reproduce it here, but I can describe what I
did.

 

I merged the template named
'section.heading' with the template that calls it, which starts with:

 

<xsl:template
match="section/title

                    
|simplesect/title

                    
|sect1/title

                    
|sect2/title

                    
|sect3/title

                    
|sect4/title

                    
|sect5/title"

             
mode="titlepage.mode"

             
priority="2">

 

Those are the final templates in the
sequence of section title templates.

 

Instead of creating in that template
a variable named 'title' whose content was the result of using
mode="object.title.markup" (which generates a combined number label
and title), I created a fo:list-block with a single fo:list-item child to
format the label and title.  The section number goes in the
fo:list-item-label, with the text-align property set to "right", and
the section title goes in fo:list-item-body, left-aligned.  On the
list-block set the provisional-label-separation equal to the space you want
between the label and title, and set the provisional-distance-between starts
equal to the width of the area for the label (including the separation
space).  

 

To generate the title, process the
section in mode="title.markup".  To generate the label, process
the section in mode="label.markup".  Since the above template's
context element is the title itself, to get the section parent you need to use
a select=".." when you apply templates in those modes.  

 

Hope this is enough to get you
started.

 

Bob Stayton

Sagehill Enterprises

DocBook Consulting



 

 

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

From: Skopik Pavel 

To: 

Sent: Thursday,
March 30, 2006 6:27 AM

Subject:
[docbook-apps] section title customization

 

Hello,

 

I would like to customize section
titles in more advanced way than by means of section.title.properties
attributes. But in comparison to chapter title templates this seems to be a
much more complicated task. I had a look at section.heading template, but I am
not quite sure where to start. 

 

My idea of customizing section
titles is like this:

 

1.    Title

   Text of section

        
1.2      
Title

                 
Text of section     

      1.2.3       Title

                 Text
of section

 

I would like to indent the body text
and wrap section numer label and title into two separate fo:inline elements so
that the number label is aligned to the right and the title starts at the
beginning of body text indentation. The problem is I was not able to find out
proper parts of template which generate this content. The structure of section
templates is much different from chapter templates.

 

Has anyone tried such a bit more
complicated layout? I would be very grateful for any response and experience.

 

Best regards

 

Pavel Skopik

 

 

Next in thread → Next in month →