Hi, Mike,

I decided to give a non-mode method a go. I also decided to use XSLT 1.0. 
Here's the result:

Given this toy XML source file:

<book>
  <front id="1">
    <!-- Title, copyright, etc. -->
    <chapter title="Known and Suspected Contributors" id="11">
      <!-- Content here somewhere! -->
    </chapter>
  </front>
  <body id="2">
    <chapter title="Using Frombotzers" id="21">
      <topic title="Using a Deteronic Frombotzer" id="211">
        <heading title="Warming up a Deteronic Frombotzer" id="2111">
          <!-- and so on -->
        </heading>
        <heading title="Applying a Deteronic Frombotzer" id="2112">
          <!-- and so on -->
        </heading>
      </topic>
      <topic title="Using a Widgetizing Frombotzer" id="212">
        <heading title="Warming up a Widgetizing Frombotzer" id="2121">
          <!-- and so on -->
        </heading>
        <heading title="Applying a Widgetizing Frombotzer" id="2122">
          <!-- and so on -->
        </heading>
      </topic>
    </chapter>
    <chapter title="Using Natwoozers" id="22">
      <topic title="Using a Deteronic Natwoozer" id="221">
        <heading title="Warming up a Deteronic Natwoozer" id="2211">
          <!-- and so on -->
        </heading>
        <heading title="Applying a Deteronic Natwoozer" id="2212">
          <!-- and so on -->
        </heading>
      </topic>
      <topic title="Using a Widgetizing Natwoozer" id="222">
        <heading title="Warming up a Widgetizing Natwoozer" id="2221">
          <!-- and so on -->
        </heading>
        <heading title="Applying a Widgetizing Natwoozer" id="2222">
          <!-- and so on -->
        </heading>
      </topic>
    </chapter>
  </body>
  <back id="3"> <!-- appendices, glossary, index -->
    <chapter title="Attorneys with Frombotzer and Natwoozer Experience" 
id="31">
      <!-- The list of attorneys -->
    </chapter>
    <glossary id="glossary">
      <!-- glossary entries -->
    </glossary>
    <index id="index">
      <!-- index entries -->
    </index>
  </back>
</book>

And applying this XSL file:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
  version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns:fo="http://www.w3.org/1999/XSL/Format";
  exclude-result-prefixes="fo"
>

  <xsl:include href="contentsstyles.xsl"/>

  <xsl:template match="book">
    <!-- All the usual stuff to build a document omitted
         to focus on the table of contents -->
    <xsl:for-each select="front/chapter">
      <fo:block xsl:use-attribute-sets="contents1">
        <fo:basic-link internal-destination="[EMAIL PROTECTED]" 
color="#0000ff"><xsl:value-of select="@title"/></fo:basic-link>
        <fo:leader leader-pattern="dots" leader-length.maximum="100%"/>
        <fo:page-number-citation ref-id="[EMAIL PROTECTED]"/>
      </fo:block>
    </xsl:for-each>
    <xsl:for-each select="body/chapter">
      <fo:block xsl:use-attribute-sets="contents1">
        <fo:basic-link internal-destination="[EMAIL PROTECTED]" 
color="#0000ff"><xsl:value-of select="@title"/></fo:basic-link>
        <fo:leader leader-pattern="dots" leader-length.maximum="100%"/>
        <fo:page-number-citation ref-id="[EMAIL PROTECTED]"/>
      </fo:block>
      <xsl:for-each select="topic">
        <fo:block xsl:use-attribute-sets="contents2">
          <fo:basic-link internal-destination="[EMAIL PROTECTED]" 
color="#0000ff"><xsl:value-of select="@title"/></fo:basic-link>
          <fo:leader leader-pattern="dots" leader-length.maximum="100%"/>
          <fo:page-number-citation ref-id="[EMAIL PROTECTED]"/>
        </fo:block>
        <xsl:for-each select="heading">
          <fo:block xsl:use-attribute-sets="contents3">
            <fo:basic-link internal-destination="[EMAIL PROTECTED]" 
color="#0000ff"><xsl:value-of select="@title"/></fo:basic-link>
            <fo:leader leader-pattern="dots" 
leader-length.maximum="100%"/>
            <fo:page-number-citation ref-id="[EMAIL PROTECTED]"/>
          </fo:block>
        </xsl:for-each>
      </xsl:for-each>
    </xsl:for-each>
    <xsl:for-each select="back/chapter">
      <fo:block xsl:use-attribute-sets="contents1">
        <fo:basic-link internal-destination="[EMAIL PROTECTED]" 
color="#0000ff"><xsl:value-of select="@title"/></fo:basic-link>
        <fo:leader leader-pattern="dots" leader-length.maximum="100%"/>
        <fo:page-number-citation ref-id="[EMAIL PROTECTED]"/>
      </fo:block>
    </xsl:for-each>
    <fo:block xsl:use-attribute-sets="contents1">
      <fo:basic-link internal-destination="glossary" 
color="#0000ff">Glossary</fo:basic-link>
      <fo:leader leader-pattern="dots" leader-length.maximum="100%"/>
      <fo:page-number-citation ref-id="glossary"/>
    </fo:block>
    <fo:block xsl:use-attribute-sets="contents1">
      <fo:basic-link internal-destination="index" 
color="#0000ff">Index</fo:basic-link>
      <fo:leader leader-pattern="dots" leader-length.maximum="100%"/>
      <fo:page-number-citation ref-id="index"/>
    </fo:block>
  </xsl:template>

</xsl:stylesheet>

Produces this FO fragment:

<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"; font-size="12pt" 
font-family="sans-serif" line-height="16pt" space-before.optimum="6pt" 
space-after.optimum="3pt" text-align-last="justify">
  <fo:basic-link internal-destination="11" color="#0000ff">Known and 
Suspected Contributors</fo:basic-link>
  <fo:leader leader-pattern="dots" leader-length.maximum="100%"/>
  <fo:page-number-citation ref-id="11"/>
</fo:block>
<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"; font-size="12pt" 
font-family="sans-serif" line-height="16pt" space-before.optimum="6pt" 
space-after.optimum="3pt" text-align-last="justify">
  <fo:basic-link internal-destination="21" color="#0000ff">Using 
Frombotzers</fo:basic-link>
  <fo:leader leader-pattern="dots" leader-length.maximum="100%"/>
  <fo:page-number-citation ref-id="21"/>
</fo:block>
<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"; font-size="12pt" 
font-family="sans-serif" line-height="16pt" space-before.optimum="3pt" 
space-after.optimum="3pt" text-align-last="justify" text-indent=".25in">
  <fo:basic-link internal-destination="211" color="#0000ff">Using a 
Deteronic Frombotzer</fo:basic-link>
  <fo:leader leader-pattern="dots" leader-length.maximum="100%"/>
  <fo:page-number-citation ref-id="211"/>
</fo:block>
<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"; font-size="12pt" 
font-family="sans-serif" line-height="16pt" space-before.optimum="0pt" 
space-after.optimum="3pt" text-align-last="justify" text-indent=".5in">
  <fo:basic-link internal-destination="2111" color="#0000ff">Warming up a 
Deteronic Frombotzer</fo:basic-link>
  <fo:leader leader-pattern="dots" leader-length.maximum="100%"/>
  <fo:page-number-citation ref-id="2111"/>
</fo:block>
<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"; font-size="12pt" 
font-family="sans-serif" line-height="16pt" space-before.optimum="0pt" 
space-after.optimum="3pt" text-align-last="justify" text-indent=".5in">
  <fo:basic-link internal-destination="2112" color="#0000ff">Applying a 
Deteronic Frombotzer</fo:basic-link>
  <fo:leader leader-pattern="dots" leader-length.maximum="100%"/>
  <fo:page-number-citation ref-id="2112"/>
</fo:block>
<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"; font-size="12pt" 
font-family="sans-serif" line-height="16pt" space-before.optimum="3pt" 
space-after.optimum="3pt" text-align-last="justify" text-indent=".25in">
  <fo:basic-link internal-destination="212" color="#0000ff">Using a 
Widgetizing Frombotzer</fo:basic-link>
  <fo:leader leader-pattern="dots" leader-length.maximum="100%"/>
  <fo:page-number-citation ref-id="212"/>
</fo:block>
<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"; font-size="12pt" 
font-family="sans-serif" line-height="16pt" space-before.optimum="0pt" 
space-after.optimum="3pt" text-align-last="justify" text-indent=".5in">
  <fo:basic-link internal-destination="2121" color="#0000ff">Warming up a 
Widgetizing Frombotzer</fo:basic-link>
  <fo:leader leader-pattern="dots" leader-length.maximum="100%"/>
  <fo:page-number-citation ref-id="2121"/>
</fo:block>
<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"; font-size="12pt" 
font-family="sans-serif" line-height="16pt" space-before.optimum="0pt" 
space-after.optimum="3pt" text-align-last="justify" text-indent=".5in">
  <fo:basic-link internal-destination="2122" color="#0000ff">Applying a 
Widgetizing Frombotzer</fo:basic-link>
  <fo:leader leader-pattern="dots" leader-length.maximum="100%"/>
  <fo:page-number-citation ref-id="2122"/>
</fo:block>
<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"; font-size="12pt" 
font-family="sans-serif" line-height="16pt" space-before.optimum="6pt" 
space-after.optimum="3pt" text-align-last="justify">
  <fo:basic-link internal-destination="22" color="#0000ff">Using 
Natwoozers</fo:basic-link>
  <fo:leader leader-pattern="dots" leader-length.maximum="100%"/>
  <fo:page-number-citation ref-id="22"/>
</fo:block>
<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"; font-size="12pt" 
font-family="sans-serif" line-height="16pt" space-before.optimum="3pt" 
space-after.optimum="3pt" text-align-last="justify" text-indent=".25in">
  <fo:basic-link internal-destination="221" color="#0000ff">Using a 
Deteronic Natwoozer</fo:basic-link>
  <fo:leader leader-pattern="dots" leader-length.maximum="100%"/>
  <fo:page-number-citation ref-id="221"/>
</fo:block>
<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"; font-size="12pt" 
font-family="sans-serif" line-height="16pt" space-before.optimum="0pt" 
space-after.optimum="3pt" text-align-last="justify" text-indent=".5in">
  <fo:basic-link internal-destination="2211" color="#0000ff">Warming up a 
Deteronic Natwoozer</fo:basic-link>
  <fo:leader leader-pattern="dots" leader-length.maximum="100%"/>
  <fo:page-number-citation ref-id="2211"/>
</fo:block>
<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"; font-size="12pt" 
font-family="sans-serif" line-height="16pt" space-before.optimum="0pt" 
space-after.optimum="3pt" text-align-last="justify" text-indent=".5in">
  <fo:basic-link internal-destination="2212" color="#0000ff">Applying a 
Deteronic Natwoozer</fo:basic-link>
  <fo:leader leader-pattern="dots" leader-length.maximum="100%"/>
  <fo:page-number-citation ref-id="2212"/>
</fo:block>
<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"; font-size="12pt" 
font-family="sans-serif" line-height="16pt" space-before.optimum="3pt" 
space-after.optimum="3pt" text-align-last="justify" text-indent=".25in">
  <fo:basic-link internal-destination="222" color="#0000ff">Using a 
Widgetizing Natwoozer</fo:basic-link>
  <fo:leader leader-pattern="dots" leader-length.maximum="100%"/>
  <fo:page-number-citation ref-id="222"/>
</fo:block>
<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"; font-size="12pt" 
font-family="sans-serif" line-height="16pt" space-before.optimum="0pt" 
space-after.optimum="3pt" text-align-last="justify" text-indent=".5in">
  <fo:basic-link internal-destination="2221" color="#0000ff">Warming up a 
Widgetizing Natwoozer</fo:basic-link>
  <fo:leader leader-pattern="dots" leader-length.maximum="100%"/>
  <fo:page-number-citation ref-id="2221"/>
</fo:block>
<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"; font-size="12pt" 
font-family="sans-serif" line-height="16pt" space-before.optimum="0pt" 
space-after.optimum="3pt" text-align-last="justify" text-indent=".5in">
  <fo:basic-link internal-destination="2222" color="#0000ff">Applying a 
Widgetizing Natwoozer</fo:basic-link>
  <fo:leader leader-pattern="dots" leader-length.maximum="100%"/>
  <fo:page-number-citation ref-id="2222"/>
</fo:block>
<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"; font-size="12pt" 
font-family="sans-serif" line-height="16pt" space-before.optimum="6pt" 
space-after.optimum="3pt" text-align-last="justify">
  <fo:basic-link internal-destination="31" color="#0000ff">Attorneys with 
Frombotzer and Natwoozer Experience</fo:basic-link>
  <fo:leader leader-pattern="dots" leader-length.maximum="100%"/>
  <fo:page-number-citation ref-id="31"/>
</fo:block>
<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"; font-size="12pt" 
font-family="sans-serif" line-height="16pt" space-before.optimum="6pt" 
space-after.optimum="3pt" text-align-last="justify">
  <fo:basic-link internal-destination="glossary" 
color="#0000ff">Glossary</fo:basic-link>
  <fo:leader leader-pattern="dots" leader-length.maximum="100%"/>
  <fo:page-number-citation ref-id="glossary"/>
</fo:block>
<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"; font-size="12pt" 
font-family="sans-serif" line-height="16pt" space-before.optimum="6pt" 
space-after.optimum="3pt" text-align-last="justify">
  <fo:basic-link internal-destination="index" 
color="#0000ff">Index</fo:basic-link>
  <fo:leader leader-pattern="dots" leader-length.maximum="100%"/>
  <fo:page-number-citation ref-id="index"/>
</fo:block>

This example glosses over all sorts of issues (using generated IDs, 
dealing with the repeated namespace, and so on), but it gives an example 
of how you might approach the problem without resorting to modes. Also, I 
didn't post the contentsstyle.xsl file, as this message is already an 
oversize load. If someone wants to see how that trick works, ask about it 
sometime and I'll provide a better example.

FWIW

Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)




Mike J Boyersmith <[EMAIL PROTECTED]> 
04/19/2005 02:04 PM
Please respond to
fop-users@xmlgraphics.apache.org


To
fop-users@xmlgraphics.apache.org
cc

Subject
Re: Generating table of contents using FO and FOP?







ROTFL... your the man here, I think I wasn't awake yet when I looked at 
that 
snippet. Thanks again Jay :D 

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

Take a look at the author of that message - proof that what goes around 
comes around.

Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)

Mike J Boyersmith <[EMAIL PROTECTED]> 
04/19/2005 11:43 AM
Please respond to
fop-users@xmlgraphics.apache.org

To
fop-users@xmlgraphics.apache.org
cc

Subject
Re: Generating table of contents using FO and FOP?



Thought I'd share this with the list, I found another way to render a 
TOC using fo:page-number-citation tags. 

heres a semi example I found on this idea. 

http://www.stylusstudio.com/xsllist/200503/post30180.html 

- Mike 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to