Re: Section[1] only in toc

Bob Stayton <[email protected]>
Newsgroups gmane.text.docbook.apps
Message-ID <[email protected]>
Hi Peter,

This is what I would try (I haven't tested it, so let me know if it 
doesn't work).

In fo/autotoc.xsl, elements for a TOC are selected as a set of $nodes 
and then those nodes are processed in mode="toc".   In those templates, 
each line in the toc is generated by calling the template named 
"toc.line".  This template handles an article:

<xsl:template match="preface|chapter|appendix|article" mode="toc">

You can create a custom template that matches on only "article" that 
removes the call to "toc.line" and processes the top-level sections in a 
for-each loop:

<xsl:for-each select="d:section">
    <xsl:call-template name="toc.line">
       <xsl:with-param name="toc-context" select="$toc-context"/>
   </xsl:call-template>
</xsl:for-each>

The "toc.line" template does not process any subsections.

Bob Stayton
[email protected]

On 4/1/2020 2:05 AM, Peter Fleck wrote:
> Yes, sorry FO, I know I can use a manual.toc for HTML.
>
> Thanks,
>
> Peter
>
> On Tue, 31 Mar 2020 at 23:27, Bob Stayton <[email protected] 
> <mailto:[email protected]>> wrote:
>
>     You didn't mention whether this was for FO or HTML type of output.
>
>     Bob Stayton
>     [email protected]  <mailto:[email protected]>
>
>     On 3/31/2020 2:08 PM, Peter Fleck wrote:
>>     I have an abnormal use case.
>>
>>     The source file is a book with many articles, however the TOC is
>>     to be first level sections of each article and not the article
>>     title itself.
>>
>>     Example:
>>
>>     <article>
>>     <info><title></info>                        -- not included
>>     <section><info><title></info></section>    -- included
>>     <section><info><title></info></section>    -- included
>>     ...
>>     </article>
>>     <article>
>>     <info><title></info>                          -- not included
>>     <section><info><title></info></section>    -- included
>>     <section><info><title></info></section>    -- included
>>     ...
>>     </article>
>>
>>     Any pointers would be appreciated.
>>
>>     Thanks,
>>
>>     Peter
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.