I'm making some progress on this.

I've customized the toc.line template, replacing the fo:block by fo:list-block.

While I am now seeing the alignment I want I am not getting any indentation.  
The original form of toc.line does show indentation.

I haven't customized any mode="toc" templates so the calling and use of 
set.toc.indent has not changed but the indentation is not working now the 
toc.lines are using list-blocks.



Does anyone have any idea what might be missing.





Regards,

Richard.





I'm using Fop-1.1 for th FO-PDF conversion.











Richard Kerry
BNCS Engineer
T: +44 (0)20 82259063
M: +44 (0)7812 325518
Room EBX 301, BBC Television Centre, Wood Lane, London, W12 7RJ
[email protected]<https://webmail.siemens-it-solutions.com/owa/redir.aspx?C=9fb20d019e3e4cb99344d708709a3177&URL=mailto%3arichard.kerry%40atos.net>
uk.atos.net<https://webmail.siemens-it-solutions.com/owa/redir.aspx?C=9fb20d019e3e4cb99344d708709a3177&URL=http%3a%2f%2fuk.atos.net%2fen-uk%2f>
This e-mail and the documents attached are confidential and intended solely for 
the addressee; it may also be privileged. If you receive this e-mail in error, 
please notify the sender immediately and destroy it. As its integrity cannot be 
secured on the Internet, the Atos group liability cannot be triggered for the 
message content. Although the sender endeavours to maintain a computer 
virus-free network, the sender does not warrant that this transmission is 
virus-free and will not be liable
________________________________
From: Kerry, Richard [[email protected]]
Sent: 03 May 2013 17:23
To: [email protected]
Subject: RE: [docbook-apps] Alignment / tabular formatting of ToC in FO


Bob,



"What you want isn't possible with just the existing attribute-sets."

That's what I thought.



"If you want to pursue a customization, I can give some guidance."

That is very helpful of you, thank you.



I shall study your explanation and attempt some further customizations.





Appreciatively,

Richard.










[Blue line]
Richard Kerry
BNCS Engineer
T: +44 (0)20 
82259063[cid:A7813E7-5425-4D355-99D4-A84DFEBCA0@MimeCtl]<about:blank#>
M: +44 (0)7812 
325518[cid:A7813E7-5425-4D355-99D4-A84DFEBCA0@MimeCtl]<about:blank#>
Room EBX 301, BBC Television Centre, Wood Lane, London, W12 7RJ
[email protected]<mailto:[email protected]>
uk.atos.net<http://uk.atos.net/en-uk/>
[Atos logo]
This e-mail and the documents attached are confidential and intended solely for 
the addressee; it may also be privileged. If you receive this e-mail in error, 
please notify the sender immediately and destroy it. As its integrity cannot be 
secured on the Internet, the Atos group liability cannot be triggered for the 
message content. Although the sender endeavours to maintain a computer 
virus-free network, the sender does not warrant that this transmission is 
virus-free and will not be liable
________________________________
From: Bob Stayton [[email protected]]
Sent: 26 April 2013 22:19
To: Kerry, Richard; [email protected]
Subject: Re: [docbook-apps] Alignment / tabular formatting of ToC in FO

Hi Richard,
What you want isn't possible with just the existing attribute-sets.  If you 
want to pursue a customization, I can give some guidance.

There are two levels of formatting in the FO table of contents: mode="toc" and 
toc.line.   The document hierarchy is processed in mode="toc", and there are 
templates matching on different hierarchical elements in that mode (all in 
fo/autotoc.xsl).  Each of those templates does the following:

1.  It calls the toc.line template to generate the text, leader, and page 
reference for the current element.

2.  If the element has TOC children, it also creates an fo:block, adds an 
indent by calling the template named 'set.toc.indent' (here 'set' is a verb, 
not a noun), and processes those children inside that indented block, in 
mode="toc".

If you have examined the toc.line template, you may have noticed that it starts 
with:

<fo:block xsl:use-attribute-sets="toc.line.properties">

So all the toc.lines use the same attribute set.  The differences occur in the 
outer container block for the group of children, where the indent for the whole 
set is added.

To accomplish the "tabbed" look you want, you can change the fo:block in 
toc.line to fo:list-block, which is like a two-column table.  You put the label 
in the fo:list-item-label, and the title, leader, and page reference in the 
fo:list-item-body.  This section in my book shows how to set up such an element:

http://www.sagehill.net/docbookxsl/SideBySide.html

The trick is to match the relative indent of the fo:list-item-body with the 
relative indent of any child elements.  That way, the children that follow have 
their section number (in their list-item-label) indented the same amount as the 
parent's title (in its list-item-body).

As Jan pointed out, one thing you have to be aware of is that those indents now 
have to be wide enough to accomodate the widest section number, or the widest 
ones will wrap badly.  Making the matching indents wider as you go deeper is 
possible by modifying the 'set.toc.indent' template to make it wider for 
greater depth.  And the mode="toc" templates need to do the same thing.

To get different font styles for different levels, you could add a mode to 
generate attribute elements:

<fo:list-block ...>
  <xsl:apply-templates select="." mode="toc.line.properties"/>
  <fo:list-item>

and then add templates for each element, specifying its own attribute elements:

<xsl:template match="d:chapter" mode="toc.line.properties">
  <xsl:attribute ...>
  <xsl:attribute ...>
</xsl:template>

Using a mode avoids the problem of conditionalizing attribute-sets, which is 
difficult.

Bob Stayton
Sagehill Enterprises
[email protected]<mailto:[email protected]>

From: Kerry, Richard<mailto:[email protected]>
Sent: Friday, April 26, 2013 10:51 AM
To: DocBook Apps Mailing List 
‎[[email protected]]‎<mailto:[email protected]]â€?>
Subject: [docbook-apps] Alignment / tabular formatting of ToC in FO




I'm working on a docbook document which I am currently trying to process to PDF 
via FO.

The document is an <article>.



I'm generally copying the formatting of an existing set of Word documents.

In particular at the moment I'm looking at the appearance of the ToC pages.



In the standard stylesheets, each line of ToC is generated looking rather like 
this :



1. Overview 
..........................................................................................
 3

2. Description 
.......................................................................................
 3

3. Applicable Documents 
......................................................................... 3

4. Configuration procedure 
...................................................................... 3

5. Starting up 
.......................................................................................
 3

       5.1. Dependencies 
.......................................................................... 3

               5.1.1. Level 3 Heading 
............................................................. 3

6. Features 
..........................................................................................
 3

      6.1. Diagnostics 
.............................................................................. 4

      6.2. Test procedures 
....................................................................... 4

7. Known Issues 
...................................................................................
 5

8. Version History 
.................................................................................
 5



ie the title string is immediately followed by the leader.  No difference in 
styling.

(the page numbers are aligned in the PDF document, even though they may not be 
here.



The apearance I am looking for is more like the following :



Contents 
.....................................................................................................
 1<about:blank#_Toc354480557>

1     Overview. 
................................................................................................
 4<about:blank#_Toc354480558>

1.1          Description. 
...................................................................................
 4<about:blank#_Toc354480559>

1.2          Device firmware version. 
.................................................................. 
4<about:blank#_Toc354480560>

1.3          Configuration. 
................................................................................
 4<about:blank#_Toc354480561>

1.3.1   The v1/v2 Location 
.......................................................................... 
4<about:blank#_Toc354480562>

1.3.2   The V3 Location 
............................................................................ 
5<about:blank#_Toc354480563>

1.3.3   The V4 Location 
............................................................................ 
5<about:blank#_Toc354480564>

1.4          Driver compatibility. 
........................................................................ 
5<about:blank#_Toc354480565>

1.5          Version. 
.......................................................................................
 5<about:blank#_Toc354480566>

1.5.1   Automatic Shutdown on Closing. 
........................................................ 
5<about:blank#_Toc354480567>

1.6          Messaging System – If32.dll.  
............................................................. 
5<about:blank#_Toc354480568>





Again the page numbers should appear lined up.  Not sure if the rest of this 
will come through on this list.

The different section levels should have different styles.



The particular requirements here are :

1. Section numbers at each level are aligned.

2. Headings at each level are alligned.

3. Headings and section numbers at each level have different styles.



Can the styling can be done using existing attribute sets ?  I can see that 
such attibute sets exist for the actual section titles, but I can't see any for 
the titles as shown in the ToC.



I am not sure how I can do the alignment.

I was thinking it might be doable using an fo:table, but there are a number of 
separate alignment lines (columns) so that doesn't seem to me like a table.

I see that the default stylesheet does start each level at the same alignment.  
But that only applies to the section numbers.  The title text starts 
immediately after the number, where I want that text also to be on a per-level 
alignment.



Can anyone advise how I should approach this.



I believe the per-line formatting is done by template toc.line, from 
fo/autotoc.xsl.  But I'm not clear where the page is generated from.





Appreciatively,

Richard.










Richard Kerry
BNCS Engineer
T: +44 (0)20 82259063<about:blank#>
M: +44 (0)7812 325518<about:blank#>
Room EBX 301, BBC Television Centre, Wood Lane, London, W12 7RJ
[email protected]<https://webmail.siemens-it-solutions.com/owa/redir.aspx?C=9fb20d019e3e4cb99344d708709a3177&URL=mailto%3arichard.kerry%40atos.net>
uk.atos.net<https://webmail.siemens-it-solutions.com/owa/redir.aspx?C=9fb20d019e3e4cb99344d708709a3177&URL=http%3a%2f%2fuk.atos.net%2fen-uk%2f>
This e-mail and the documents attached are confidential and intended solely for 
the addressee; it may also be privileged. If you receive this e-mail in error, 
please notify the sender immediately and destroy it. As its integrity cannot be 
secured on the Internet, the Atos group liability cannot be triggered for the 
message content. Although the sender endeavours to maintain a computer 
virus-free network, the sender does not warrant that this transmission is 
virus-free and will not be liable

________________________________

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Attachment: blank
Description: blank

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to