OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: RE: [docbook-apps] Conditionals in TOCs


Well I managed to solve my own question after about 14 hrs of poking around.  The solution to this problem was not to do conditionals in that template but to move up to the template that calls this one.  The solution is below:

 

<!-- Customized toc output for chapter TOC only -->

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

                                    <xsl:param name="pageclass" select="''"/>

                        <xsl:param name="sequence" select="''"/>

                        <xsl:param name="gentext-key" select="''"/>

                        <xsl:param name="toc-context" select="."/>

                        <xsl:variable name="id">

                                    <xsl:call-template name="object.id"/>

                        </xsl:variable>

                        <xsl:variable name="cid">

                                    <xsl:call-template name="object.id">

                                                <xsl:with-param name="object" select="$toc-context"/>

                                    </xsl:call-template>

                        </xsl:variable>

                       

                        <xsl:call-template name="toc.line"/>

                        <xsl:variable name="nodes" select="chapter"/>

                        <xsl:if test="$toc.section.depth &gt; 0 and $nodes">

                                    <fo:block id="toc.{$cid}.{$id}" start-indent="70pt + {count(ancestor::*)*$toc.indent.width}pt">

                                                <xsl:apply-templates select="$nodes" mode="toc">

                                                            <xsl:with-param name="toc-context" select="$toc-context"/>

                                                </xsl:apply-templates>

                                    </fo:block>

                        </xsl:if>

            </xsl:template>

 

This is the template that calls the toc.line template.  Its here you can define what notes are rendered by the template so I changed this line to only process chapter titles.

 

<xsl:variable name="nodes" select="chapter"/>

 

That got me the formatting for the book TOC so that it only listed chapter titles.

 

 

 


From: David White [mailto:davidw@kencook.com]
Sent: Monday, January 09, 2006 11:13 AM
To: docbook-apps@lists.oasis-open.org
Subject: [docbook-apps] Conditionals in TOCs

 

Hello again everyone

 

Something I’ve been trying to hammer out in my stylesheet is how to control some of the output in the TOCs that my book has.

 

I have a book which has a main TOC and then each chapter in the book has its own TOC as well. 

 

I need the main TOC to only list chapter/title  and the chapter TOCs to list only chapter/sect1/title or chapter/sect2/title or chapter/sect3/title

 

The main TOC is also bolded and the chapter TOCs are not.

 

To get this to work I’ve been modeling the XSLT code below:

 

            <xsl:template name="toc.line">

                        <xsl:param name="pageclass" select="''"/>

                        <xsl:param name="sequence" select="''"/>

                        <xsl:param name="position" select="''"/>

                        <xsl:param name="gentext-key" select="''"/>

                        <xsl:variable name="id">

                                    <xsl:call-template name="object.id"/>

                        </xsl:variable>

                        <xsl:variable name="label">

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

                        </xsl:variable>

                        <fo:block text-align-last="justify" text-align="start" end-indent="1in + {$toc.indent.width}pt" last-line-end-indent="-{$toc.indent.width}pt" font-family="{$body.font.family}" span="all">

                                    <xsl:choose>

                                                <xsl:when test="self::chapter or self::preface or self::appendix">

                                                            <xsl:attribute name="space-before">4pt</xsl:attribute>

                                                            <xsl:attribute name="space-after">4pt</xsl:attribute>

                                                </xsl:when>

                                                <xsl:when test="self::sect1">

                                                            <xsl:attribute name="space-before">4pt</xsl:attribute>

                                                </xsl:when>

                                    </xsl:choose>

                                    <fo:inline keep-with-next.within-line="always">

                                                <xsl:choose>

                                                            <xsl:when test="self::chapter or self::preface or self::appendix">

                                                                        <xsl:attribute name="font-weight">bold</xsl:attribute>

                                                            </xsl:when>

                                                </xsl:choose>

                                                <fo:basic-link internal-destination="{$id}">

                                                            <xsl:if test="$label != ''">

                                                                        <xsl:copy-of select="$label"/>

                                                                        <xsl:value-of select="$autotoc.label.separator"/>

                                                            </xsl:if>

                                                            <xsl:apply-templates select="." mode="titleabbrev.markup"/>

                                                </fo:basic-link>

                                    </fo:inline>

                                    <fo:inline keep-together.within-line="always">

                                                <xsl:text> </xsl:text>

                                                <fo:leader leader-pattern="dots" leader-pattern-width="3pt" leader-alignment="reference-area" keep-with-next.within-line="always"/>

                                                <xsl:text> </xsl:text>

                                                <fo:basic-link internal-destination="{$id}">

                                                            <fo:page-number-citation ref-id="{$id}" font-family="{$body.font.family}"/>

                                                </fo:basic-link>

                                    </fo:inline>

                        </fo:block>

            </xsl:template>

 

However, my question is: how can I get these params

 

                        <xsl:param name="pageclass" select="''"/>

                        <xsl:param name="sequence" select="''"/>

                        <xsl:param name="position" select="''"/>

                        <xsl:param name="gentext-key" select="''"/>

 

 

To have values?  When I output them they are blank in the above template…

 

Thanks,

 

David White



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]