docbook-apps

  • 1.  Alignment / tabular formatting of ToC in FO

    Posted 04-26-2013 17:52


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

    The document is an
    .



    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.










    [Blue line]
    Richard Kerry
    BNCS Engineer
    T: +44 (0)20 82259063[cid:A4FDD16-EA4B-4A5EE-A24E-984DDF44AF@MimeCtl]<about:blank#>
    M: +44 (0)7812 325518[cid:A4FDD16-EA4B-4A5EE-A24E-984DDF44AF@MimeCtl]<about:blank#>
    Room EBX 301, BBC Television Centre, Wood Lane, London, W12 7RJ
    richard.kerry@atos.net<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>
    [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



  • 2.  RE: [docbook-apps] Alignment / tabular formatting of ToC in FO

    Posted 04-26-2013 20:49
    Dear Richard,



    briefly, your proposal needs advanced customizations.



    But to be honest, I still prefer a default behavior.



    I‘ve already had to defend my opinion several times. Our graphics designers
    wished the same thing, but none of them was aware of several typographic
    issues:



    1. Imagine more then 9 chapters. In that case all 1-9 items will have a huge
    space between numbers and titles (introduced by that two digit number).



    2. Imagine chapters with less then 10 sections and chapters with more then
    10 sections. In that case second level titles will never be aligned the same
    way. This could be solved by not generating the FO table for each level
    separately, but globally for the whole ToC, but in that case those gaps
    could be even worse (imagine two digit numbers on every particular level).



    While a default behaviour doesn’t look well on the first look, it is much
    more flexible for complex documents with many nestes levels – all levels
    have the corresponding (and same) indentation.



    A different styling is possible, see the exhaustive Bob’s guide at
    http://www.sagehill.net/docbookxsl/PrintToc.html



    Jan





    From: Kerry, Richard [mailto:richard.kerry@atos.net]
    Sent: Friday, April 26, 2013 7:52 PM
    To: DocBook Apps Mailing List ?[docbook-apps@lists.oasis-open.org]?
    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
    .



    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 :



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

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

    <about:blank#_Toc354480559> 1.1 Description 4

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

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

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

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

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

    <about:blank#_Toc354480565> 1.4 Driver compatibility 5

    <about:blank#_Toc354480566> 1.5 Version 5

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

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





    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

    M: +44 (0)7812 325518

    Room EBX 301, BBC Television Centre, Wood Lane, London, W12 7RJ

    richard.kerry@atos.net
    <https://webmail.siemens-it-solutions.com/owa/redir.aspx?C=9fb20d019e3e4cb99
    344d708709a3177&URL=mailto%3arichard.kerry%40atos.net>


    <https://webmail.siemens-it-solutions.com/owa/redir.aspx?C=9fb20d019e3e4cb99
    344d708709a3177&URL=http%3a%2f%2fuk.atos.net%2fen-uk%2f> uk.atos.net

    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




  • 3.  RE: [docbook-apps] Alignment / tabular formatting of ToC in FO

    Posted 05-03-2013 16:13


    Jan,



    "1. Imagine more then 9 chapters" "Imagine chapters with less then 10 sections and chapters with more then 10 sections"

    I don't need to imagine either of these scenarios. Some of the Word documents I've got that I'm basing my styling on have already got more than nine sections, and in some cases also more than nine sub-sections. It looks fine to me. There is a gap between the number and the heading (you can see this in the example I gave - I've provide a few more examples below with two-digit elements in the numbers. The different levels have different font details (colour, boldness). Maybe I'm just used to it .....





    I know I need some serious customization; I'm looking at how the ToC formatting works to work out how to do it.





    Regards,

    Richard.



    A handful of further examples follows, showing a mixture of one and two digit numbers. These are copied from Word and have lost the leaders and I've deleted the page numbers - which were aligned in the original. In this particular doc they are all the same colour but the original has level 1 blue and higher levels black.

    Sorry about the underlines - tried to remove them but they won't. In the original they aren't there - they probably appear here as Word ToC entries are links to elsewhere in the doc.





    9 Control System Interface <https://webmail.siemens-it-solutions.com/OWA/?ae=PreFormAction&a=ReplyAll&t=IPM.Note&id=RgAAAADuafvq2wn5ToY5TFygcdi1BwBSOV8Rzy7HQJoPPwEYkmv2AAACvQBBAABhxn3HMwi9SbLUtlBySA26AAAVOKJ4AAAJ&pspid=_1367568809809_234075123#_Toc324942698>

    9.1 Control Overview. <https://webmail.siemens-it-solutions.com/OWA/?ae=PreFormAction&a=ReplyAll&t=IPM.Note&id=RgAAAADuafvq2wn5ToY5TFygcdi1BwBSOV8Rzy7HQJoPPwEYkmv2AAACvQBBAABhxn3HMwi9SbLUtlBySA26AAAVOKJ4AAAJ&pspid=_1367568809809_234075123#_Toc324942699>

    9.2 Sample Ini <https://webmail.siemens-it-solutions.com/OWA/?ae=PreFormAction&a=ReplyAll&t=IPM.Note&id=RgAAAADuafvq2wn5ToY5TFygcdi1BwBSOV8Rzy7HQJoPPwEYkmv2AAACvQBBAABhxn3HMwi9SbLUtlBySA26AAAVOKJ4AAAJ&pspid=_1367568809809_234075123#_Toc324942700>

    11 Filtering of Access <https://webmail.siemens-it-solutions.com/OWA/?ae=PreFormAction&a=ReplyAll&t=IPM.Note&id=RgAAAADuafvq2wn5ToY5TFygcdi1BwBSOV8Rzy7HQJoPPwEYkmv2AAACvQBBAABhxn3HMwi9SbLUtlBySA26AAAVOKJ4AAAJ&pspid=_1367568809809_234075123#_Toc324942706>

    11.1 Filtering. <https://webmail.siemens-it-solutions.com/OWA/?ae=PreFormAction&a=ReplyAll&t=IPM.Note&id=RgAAAADuafvq2wn5ToY5TFygcdi1BwBSOV8Rzy7HQJoPPwEYkmv2AAACvQBBAABhxn3HMwi9SbLUtlBySA26AAAVOKJ4AAAJ&pspid=_1367568809809_234075123#_Toc324942707>

    11.2 Address Filter Configuration. <https://webmail.siemens-it-solutions.com/OWA/?ae=PreFormAction&a=ReplyAll&t=IPM.Note&id=RgAAAADuafvq2wn5ToY5TFygcdi1BwBSOV8Rzy7HQJoPPwEYkmv2AAACvQBBAABhxn3HMwi9SbLUtlBySA26AAAVOKJ4AAAJ&pspid=_1367568809809_234075123#_Toc324942708>

    11.2.1 Wildcard Address Filtering <https://webmail.siemens-it-solutions.com/OWA/?ae=PreFormAction&a=ReplyAll&t=IPM.Note&id=RgAAAADuafvq2wn5ToY5TFygcdi1BwBSOV8Rzy7HQJoPPwEYkmv2AAACvQBBAABhxn3HMwi9SbLUtlBySA26AAAVOKJ4AAAJ&pspid=_1367568809809_234075123#_Toc324942709>

    11.2.1 Control of parameters – None, blank and comment <https://webmail.siemens-it-solutions.com/OWA/?ae=PreFormAction&a=ReplyAll&t=IPM.Note&id=RgAAAADuafvq2wn5ToY5TFygcdi1BwBSOV8Rzy7HQJoPPwEYkmv2AAACvQBBAABhxn3HMwi9SbLUtlBySA26AAAVOKJ4AAAJ&pspid=_1367568809809_234075123#_Toc324942710>

    11.3 Data Filtering. <https://webmail.siemens-it-solutions.com/OWA/?ae=PreFormAction&a=ReplyAll&t=IPM.Note&id=RgAAAADuafvq2wn5ToY5TFygcdi1BwBSOV8Rzy7HQJoPPwEYkmv2AAACvQBBAABhxn3HMwi9SbLUtlBySA26AAAVOKJ4AAAJ&pspid=_1367568809809_234075123#_Toc324942711>

    17 Syntax. <https://webmail.siemens-it-solutions.com/OWA/?ae=PreFormAction&a=ReplyAll&t=IPM.Note&id=RgAAAADuafvq2wn5ToY5TFygcdi1BwBSOV8Rzy7HQJoPPwEYkmv2AAACvQBBAABhxn3HMwi9SbLUtlBySA26AAAVOKJ4AAAJ&pspid=_1367568809809_234075123#_Toc324942752>

    17.10 Escapes <https://webmail.siemens-it-solutions.com/OWA/?ae=PreFormAction&a=ReplyAll&t=IPM.Note&id=RgAAAADuafvq2wn5ToY5TFygcdi1BwBSOV8Rzy7HQJoPPwEYkmv2AAACvQBBAABhxn3HMwi9SbLUtlBySA26AAAVOKJ4AAAJ&pspid=_1367568809809_234075123#_Toc324942770>

    17.10.1 Escapes matching <https://webmail.siemens-it-solutions.com/OWA/?ae=PreFormAction&a=ReplyAll&t=IPM.Note&id=RgAAAADuafvq2wn5ToY5TFygcdi1BwBSOV8Rzy7HQJoPPwEYkmv2AAACvQBBAABhxn3HMwi9SbLUtlBySA26AAAVOKJ4AAAJ&pspid=_1367568809809_234075123#_Toc324942771>

    17.10.2 character classes <https://webmail.siemens-it-solutions.com/OWA/?ae=PreFormAction&a=ReplyAll&t=IPM.Note&id=RgAAAADuafvq2wn5ToY5TFygcdi1BwBSOV8Rzy7HQJoPPwEYkmv2AAACvQBBAABhxn3HMwi9SbLUtlBySA26AAAVOKJ4AAAJ&pspid=_1367568809809_234075123#_Toc324942772>

    17.10.3 Properties <https://webmail.siemens-it-solutions.com/OWA/?ae=PreFormAction&a=ReplyAll&t=IPM.Note&id=RgAAAADuafvq2wn5ToY5TFygcdi1BwBSOV8Rzy7HQJoPPwEYkmv2AAACvQBBAABhxn3HMwi9SbLUtlBySA26AAAVOKJ4AAAJ&pspid=_1367568809809_234075123#_Toc324942773>














    [Blue line]
    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
    richard.kerry@atos.net<mailto:richard.kerry@atos.net>
    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: honyk [j.tosovsky@email.cz]
    Sent: 26 April 2013 21:48
    To: docbook-apps@lists.oasis-open.org
    Subject: RE: [docbook-apps] Alignment / tabular formatting of ToC in FO

    Dear Richard,

    briefly, your proposal needs advanced customizations.

    But to be honest, I still prefer a default behavior.

    I‘ve already had to defend my opinion several times. Our graphics designers wished the same thing, but none of them was aware of several typographic issues:

    1. Imagine more then 9 chapters. In that case all 1-9 items will have a huge space between numbers and titles (introduced by that two digit number).

    2. Imagine chapters with less then 10 sections and chapters with more then 10 sections. In that case second level titles will never be aligned the same way. This could be solved by not generating the FO table for each level separately, but globally for the whole ToC, but in that case those gaps could be even worse (imagine two digit numbers on every particular level).

    While a default behaviour doesn’t look well on the first look, it is much more flexible for complex documents with many nestes levels – all levels have the corresponding (and same) indentation.

    A different styling is possible, see the exhaustive Bob’s guide at http://www.sagehill.net/docbookxsl/PrintToc.html

    Jan


    From: Kerry, Richard [mailto:richard.kerry@atos.net]
    Sent: Friday, April 26, 2013 7:52 PM
    To: DocBook Apps Mailing List ?[docbook-apps@lists.oasis-open.org]?
    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
    .



    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
    M: +44 (0)7812 325518
    Room EBX 301, BBC Television Centre, Wood Lane, London, W12 7RJ
    richard.kerry@atos.net<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



  • 4.  Re: [docbook-apps] Alignment / tabular formatting of ToC in FO

    Posted 04-26-2013 21:19
    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
    bobs@sagehill.net


    From: Kerry, Richard
    Sent: Friday, April 26, 2013 10:51 AM
    To: DocBook Apps Mailing List ?[docbook-apps@lists.oasis-open.org]?
    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
    .



    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

    1 Overview. ................................................................................................ 4

    1.1 Description. ................................................................................... 4

    1.2 Device firmware version. .................................................................. 4

    1.3 Configuration. ................................................................................ 4

    1.3.1 The v1/v2 Location .......................................................................... 4

    1.3.2 The V3 Location ............................................................................ 5

    1.3.3 The V4 Location ............................................................................ 5

    1.4 Driver compatibility. ........................................................................ 5

    1.5 Version. ....................................................................................... 5

    1.5.1 Automatic Shutdown on Closing. ........................................................ 5

    1.6 Messaging System – If32.dll. ............................................................. 5





    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

    M: +44 (0)7812 325518
    Room EBX 301, BBC Television Centre, Wood Lane, London, W12 7RJ

    richard.kerry@atos.net

    uk.atos.net







    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: docbook-apps-unsubscribe@lists.oasis-open.org
    For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org


  • 5.  RE: [docbook-apps] Alignment / tabular formatting of ToC in FO

    Posted 05-03-2013 16:23
    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
    M: +44 (0)7812 325518
    Room EBX 301, BBC Television Centre, Wood Lane, London, W12 7RJ
    richard.kerry@atos.net<mailto:richard.kerry@atos.net>
    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 [bobs@sagehill.net]
    Sent: 26 April 2013 22:19
    To: Kerry, Richard; docbook-apps@lists.oasis-open.org
    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
    bobs@sagehill.net<mailto:bobs@sagehill.net>

    From: Kerry, Richard<mailto:richard.kerry@atos.net>
    Sent: Friday, April 26, 2013 10:51 AM
    To: DocBook Apps Mailing List ?[docbook-apps@lists.oasis-open.org]?<mailto:docbook-apps@lists.oasis-open.org]?>
    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
    .



    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
    richard.kerry@atos.net<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: docbook-apps-unsubscribe@lists.oasis-open.org
    For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org



  • 6.  RE: [docbook-apps] Alignment / tabular formatting of ToC in FO

    Posted 05-10-2013 11:18


    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
    richard.kerry@atos.net<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 [richard.kerry@atos.net]
    Sent: 03 May 2013 17:23
    To: docbook-apps@lists.oasis-open.org
    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
    richard.kerry@atos.net<mailto:richard.kerry@atos.net>
    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 [bobs@sagehill.net]
    Sent: 26 April 2013 22:19
    To: Kerry, Richard; docbook-apps@lists.oasis-open.org
    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
    bobs@sagehill.net<mailto:bobs@sagehill.net>

    From: Kerry, Richard<mailto:richard.kerry@atos.net>
    Sent: Friday, April 26, 2013 10:51 AM
    To: DocBook Apps Mailing List ?[docbook-apps@lists.oasis-open.org]?<mailto:docbook-apps@lists.oasis-open.org] €?>
    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
    .



    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
    richard.kerry@atos.net<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: docbook-apps-unsubscribe@lists.oasis-open.org
    For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org



  • 7.  Re: [docbook-apps] Alignment / tabular formatting of ToC in FO

    Posted 05-10-2013 16:09
    Hi Richard,
    The sample in my book sets start-indent="0mm" on the fo:list-block. If you used that property, then it would cancel the indents added elsewhere. Try removing it.

    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net


    From: Kerry, Richard
    Sent: Friday, May 10, 2013 4:17 AM
    To: docbook-apps@lists.oasis-open.org
    Subject: RE: [docbook-apps] Alignment / tabular formatting of ToC in FO




    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

    richard.kerry@atos.net

    uk.atos.net







    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 [richard.kerry@atos.net]
    Sent: 03 May 2013 17:23
    To: docbook-apps@lists.oasis-open.org
    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.













    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

    richard.kerry@atos.net

    uk.atos.net








    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 [bobs@sagehill.net]
    Sent: 26 April 2013 22:19
    To: Kerry, Richard; docbook-apps@lists.oasis-open.org
    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
    bobs@sagehill.net


    From: Kerry, Richard
    Sent: Friday, April 26, 2013 10:51 AM
    To: DocBook Apps Mailing List ?[docbook-apps@lists.oasis-open.org]?
    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
    .



    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

    1 Overview. ................................................................................................ 4

    1.1 Description. ................................................................................... 4

    1.2 Device firmware version. .................................................................. 4

    1.3 Configuration. ................................................................................ 4

    1.3.1 The v1/v2 Location .......................................................................... 4

    1.3.2 The V3 Location ............................................................................ 5

    1.3.3 The V4 Location ............................................................................ 5

    1.4 Driver compatibility. ........................................................................ 5

    1.5 Version. ....................................................................................... 5

    1.5.1 Automatic Shutdown on Closing. ........................................................ 5

    1.6 Messaging System – If32.dll. ............................................................. 5





    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

    M: +44 (0)7812 325518
    Room EBX 301, BBC Television Centre, Wood Lane, London, W12 7RJ

    richard.kerry@atos.net

    uk.atos.net







    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: docbook-apps-unsubscribe@lists.oasis-open.org
    For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org


    --------------------------------------------------------------------------------



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org


  • 8.  RE: [docbook-apps] Alignment / tabular formatting of ToC in FO

    Posted 05-10-2013 16:37


    Excellent, that's done the job.

    Thanks Bob.





    I haven't found it easy to get the hang of the details of XSL-FO. The spec (on w3.org) is the only document I've really looked at. It may be comprehensive but isn't good for learning from (not that that's what it's intended for). I think I should try a bit harder to find something to give me a better overview - I might have spotted this one.







    Regards,

    Richard.






    ________________________________
    From: Bob Stayton [bobs@sagehill.net]
    Sent: 10 May 2013 17:09
    To: Kerry, Richard; docbook-apps@lists.oasis-open.org
    Subject: Re: [docbook-apps] Alignment / tabular formatting of ToC in FO

    Hi Richard,
    The sample in my book sets start-indent="0mm" on the fo:list-block. If you used that property, then it would cancel the indents added elsewhere. Try removing it.

    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net<mailto:bobs@sagehill.net>

    From: Kerry, Richard<mailto:richard.kerry@atos.net>
    Sent: Friday, May 10, 2013 4:17 AM
    To: docbook-apps@lists.oasis-open.org<mailto:docbook-apps@lists.oasis-open.org>
    Subject: RE: [docbook-apps] Alignment / tabular formatting of ToC in FO




    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
    richard.kerry@atos.net<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 [richard.kerry@atos.net]
    Sent: 03 May 2013 17:23
    To: docbook-apps@lists.oasis-open.org
    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<about:blank#>
    M: +44 (0)7812 325518<about:blank#>
    Room EBX 301, BBC Television Centre, Wood Lane, London, W12 7RJ
    richard.kerry@atos.net<mailto:richard.kerry@atos.net>
    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 [bobs@sagehill.net]
    Sent: 26 April 2013 22:19
    To: Kerry, Richard; docbook-apps@lists.oasis-open.org
    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
    bobs@sagehill.net<mailto:bobs@sagehill.net>

    From: Kerry, Richard<mailto:richard.kerry@atos.net>
    Sent: Friday, April 26, 2013 10:51 AM
    To: DocBook Apps Mailing List ?[docbook-apps@lists.oasis-open.org]?<mailto:docbook-apps@lists.oasis-open.org]?¢ ‚¬?½>
    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
    .



    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
    richard.kerry@atos.net<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: docbook-apps-unsubscribe@lists.oasis-open.org
    For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org

    ________________________________

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org