You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by Stephen Schaub <ss...@bju.edu> on 2004/09/14 21:15:05 UTC

Generating TOC for Aggregate PDF's

More on generating PDF's from a selected set of documents using the
howto-pdf-tab:

The TOC in the PDF generated using this approach has a single top-level
entry. I edited the book2cinclude.xsl file to filter out the top-level entry
by replacing the following:

  <xsl:template match="menu[not(contains(@href, '.'))]">
    <section>
      <title><xsl:value-of select="@label"/></title>
      <xsl:apply-templates/>
    </section>
  </xsl:template>

with this:

  <xsl:template match="menu[not(contains(@href, '.'))]">
    <xsl:choose>
      <xsl:when test="name(..) = 'book' and count(../*) = 1" >
        <xsl:apply-templates/>
      </xsl:when>
      <xsl:otherwise>
        <section>
          <title><xsl:value-of select="@label"/></title>
          <xsl:apply-templates/>
        </section>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

In my tests, this effectively filters out the single top-level entry.


Stephen Schaub