You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Karin Sicheritz <ka...@lemonplanet.com> on 2001/03/15 12:54:11 UTC
table of contents
Hello,
the Fop/limitaitons page it says that page-number-citation can be used
for generating a table of contents. It would be nice to see an example
of
this. Does anyone have one?
Thanks
Karin
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org
Re: table of contents
Posted by Karen Lease <kl...@club-internet.fr>.
Hi Karin,
It looks to me as though you're generating the ID on a block which
actually contains the Table of Contents entry. You need to process your
sections twice, once to generate the actual flow object content of the
section, and once to generate the TOC. On the section itself, you should
set the id on the fo:block, using generate-id(). Then in the TOC, you
use the page-number-citation object.
Also, in the XSL you sent, you probably want to only generate the
list-item elements in the for-each. That way your TOC will just consist
of a single list with as many elements as you have sections.
You might want to check out some general XSLT tutorial resources; I'm
sure that you will find some examples of processing the same object
twice and using generate-id(). Unfortunately, I don't have a URL right
at my fingertips; but you can certainly start at www.xml.com and go on
from there.
Hope that helps,
Karen Lease
Karin Sicheritz wrote:
>
> Hi Jordan,
>
> thanks for your answer. It did not help a lot I'm afraid, maybe because I'm
> using a separate xsl file for converting the xml to pdf (by applying the
> command XalanCommandLine).
>
> I want to use the generate-id() function to make the xsl file as general as
> possible but have had no success so far. Here is an example of myxsl code
> (which doesn't work...):
>
> <xsl:for-each select="//section">
> <fo:block id="generate-id(.)"/>
>
> <fo:list-block
> provisional-distance-between-starts="15cm">
>
> <fo:list-item>
> <fo:list-item-label>
>
> <fo:block
> font-size="10pt"
> line-height="15pt"
> font-family="Helvetica">
>
> <xsl:number
> level="multiple"
> count="section"
> format="1.1.1. " />
> <xsl:value-of select="title"/>
> </fo:block>
>
> </fo:list-item-label>
> <fo:list-item-body >
> <fo:block>
> <fo:page-number-citation
> ref-id="{generate-id(@id)}"/>
> </fo:block>
> </fo:list-item-body>
> </fo:list-item>
> </fo:list-block>
>
> </xsl:for-each>
>
> Jordan Naftolin wrote:
>
> > Hi Karin,
> > Using page-number-citations to generate a table of contents is pretty easy!
> > Let's say, for example, that you'd like to have a table of contents listing
> > the chapters in your document and the page numbers on which they start.
> > Then your table of contents might contain something like the following
> > (though you might want to format it a bit nicer :)
> >
> > <fo:block>
> > Chapter 1 ... Page <fo:page-number-citation ref-id="Chapter1" />
> > </fo:block>
> >
> > Then you just have to place a block having a "Chapter1" id at the location
> > where your first Chapter starts:
> >
> > <fo:block id="Chapter1" />
> > <fo:block>Beginning of Chapter 1. It all started back in 1979....
> > </fo:block>
> >
> > Now, when FOP generates your PDF document and encounters your
> > page-number-citation, it will replace the page-number-citation element with
> > the actual page number where your <fo:block id="Chapter1"/> is located.
> > Pretty simple, huh?
> >
> > I agree that it would be helpful to have a complete example of this table of
> > content functionality. I had thought that such an example already existed,
> > but if not, then one should definitely be added to the examples directory.
> > I can try writing one up over the weekend, unless someone else already has
> > simple example already made and wouldn't mind contributing it.
> >
> > If you'd like to see an example of a resulting PDF which makes use of
> > page-number-citations, you can check out the xerces-c pdf documentation at
> > http://xml.apache.org/xerces-c/pdf.html.
> >
> > I hope this helps Karin!
> >
> > Jordan
> >
> > ----- Original Message -----
> > From: "Karin Sicheritz" <ka...@lemonplanet.com>
> > To: <fo...@xml.apache.org>
> > Sent: Thursday, March 15, 2001 6:54 AM
> > Subject: table of contents
> >
> > > Hello,
> > >
> > > the Fop/limitaitons page it says that page-number-citation can be used
> > > for generating a table of contents. It would be nice to see an example
> > > of
> > > this. Does anyone have one?
> > >
> > >
> > > Thanks
> > > Karin
> > >
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org
Re: table of contents
Posted by Karin Sicheritz <ka...@lemonplanet.com>.
Hi Jordan,
thanks for your answer. It did not help a lot I'm afraid, maybe because I'm
using a separate xsl file for converting the xml to pdf (by applying the
command XalanCommandLine).
I want to use the generate-id() function to make the xsl file as general as
possible but have had no success so far. Here is an example of myxsl code
(which doesn't work...):
<xsl:for-each select="//section">
<fo:block id="generate-id(.)"/>
<fo:list-block
provisional-distance-between-starts="15cm">
<fo:list-item>
<fo:list-item-label>
<fo:block
font-size="10pt"
line-height="15pt"
font-family="Helvetica">
<xsl:number
level="multiple"
count="section"
format="1.1.1. " />
<xsl:value-of select="title"/>
</fo:block>
</fo:list-item-label>
<fo:list-item-body >
<fo:block>
<fo:page-number-citation
ref-id="{generate-id(@id)}"/>
</fo:block>
</fo:list-item-body>
</fo:list-item>
</fo:list-block>
</xsl:for-each>
Jordan Naftolin wrote:
> Hi Karin,
> Using page-number-citations to generate a table of contents is pretty easy!
> Let's say, for example, that you'd like to have a table of contents listing
> the chapters in your document and the page numbers on which they start.
> Then your table of contents might contain something like the following
> (though you might want to format it a bit nicer :)
>
> <fo:block>
> Chapter 1 ... Page <fo:page-number-citation ref-id="Chapter1" />
> </fo:block>
>
> Then you just have to place a block having a "Chapter1" id at the location
> where your first Chapter starts:
>
> <fo:block id="Chapter1" />
> <fo:block>Beginning of Chapter 1. It all started back in 1979....
> </fo:block>
>
> Now, when FOP generates your PDF document and encounters your
> page-number-citation, it will replace the page-number-citation element with
> the actual page number where your <fo:block id="Chapter1"/> is located.
> Pretty simple, huh?
>
> I agree that it would be helpful to have a complete example of this table of
> content functionality. I had thought that such an example already existed,
> but if not, then one should definitely be added to the examples directory.
> I can try writing one up over the weekend, unless someone else already has
> simple example already made and wouldn't mind contributing it.
>
> If you'd like to see an example of a resulting PDF which makes use of
> page-number-citations, you can check out the xerces-c pdf documentation at
> http://xml.apache.org/xerces-c/pdf.html.
>
> I hope this helps Karin!
>
> Jordan
>
> ----- Original Message -----
> From: "Karin Sicheritz" <ka...@lemonplanet.com>
> To: <fo...@xml.apache.org>
> Sent: Thursday, March 15, 2001 6:54 AM
> Subject: table of contents
>
> > Hello,
> >
> > the Fop/limitaitons page it says that page-number-citation can be used
> > for generating a table of contents. It would be nice to see an example
> > of
> > this. Does anyone have one?
> >
> >
> > Thanks
> > Karin
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
> > For additional commands, email: fop-dev-help@xml.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
> For additional commands, email: fop-dev-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org
Re: table of contents
Posted by Jordan Naftolin <jo...@jtcsv.com>.
Hi Karin,
Using page-number-citations to generate a table of contents is pretty easy!
Let's say, for example, that you'd like to have a table of contents listing
the chapters in your document and the page numbers on which they start.
Then your table of contents might contain something like the following
(though you might want to format it a bit nicer :)
<fo:block>
Chapter 1 ... Page <fo:page-number-citation ref-id="Chapter1" />
</fo:block>
Then you just have to place a block having a "Chapter1" id at the location
where your first Chapter starts:
<fo:block id="Chapter1" />
<fo:block>Beginning of Chapter 1. It all started back in 1979....
</fo:block>
Now, when FOP generates your PDF document and encounters your
page-number-citation, it will replace the page-number-citation element with
the actual page number where your <fo:block id="Chapter1"/> is located.
Pretty simple, huh?
I agree that it would be helpful to have a complete example of this table of
content functionality. I had thought that such an example already existed,
but if not, then one should definitely be added to the examples directory.
I can try writing one up over the weekend, unless someone else already has
simple example already made and wouldn't mind contributing it.
If you'd like to see an example of a resulting PDF which makes use of
page-number-citations, you can check out the xerces-c pdf documentation at
http://xml.apache.org/xerces-c/pdf.html.
I hope this helps Karin!
Jordan
----- Original Message -----
From: "Karin Sicheritz" <ka...@lemonplanet.com>
To: <fo...@xml.apache.org>
Sent: Thursday, March 15, 2001 6:54 AM
Subject: table of contents
> Hello,
>
> the Fop/limitaitons page it says that page-number-citation can be used
> for generating a table of contents. It would be nice to see an example
> of
> this. Does anyone have one?
>
>
> Thanks
> Karin
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
> For additional commands, email: fop-dev-help@xml.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org