xmlgraphics-fop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karin Sicheritz <karin.sicher...@lemonplanet.com>
Subject Re: table of contents
Date Thu, 22 Mar 2001 08:53:12 GMT
Thanks Martin, my problem is solved and I'm a little bit wiser.


Karin

Martin Roob wrote:

> Hello,
> your problem is in the syntax of your stylesheet.
> You have to write id="{generate-id(.)}" (the curly braces are
> important).
> Then the xslt-processor (Xalan) always evaluates the expression when it
> is instantiating the template.
> (This is, when it creates a new fo:block here).
> Otherwise the attribute value is just the string "generate-id()", which
> is a fine id, but only for the first one, the next blocks has the same
> id, which is not ok.
> So the error, you see, in fact is an error produced by the XML Parser,
> not by Xalan, not by FOP.
> Hope that helps.
> Martin
>
> Karin Sicheritz schrieb:
> >
> > Is it possible at all to use the generate-id() function for creating a
> > table of contents when generating a pdf (with  XalanConmmandLine) from
> > xml and xsl? Fop does not seem create a unique id, for the block in
> > question. The error message is the following:
> >
> >  [2FATAL ERROR: The id "generate-id()" already exists in this document
> >
> > The code used in the xsl file is the following for the main pages:
> >
> >   <xsl:for-each select="//section">
> >
> >       <fo:block
> >         text-align="start"
> >         font-size="12pt"
> >         line-height="21pt"
> >         font-weight="bold"
> >         font-family="Helvetica"
> >         space-after.optimum="10pt"
> >         id="generate-id(.)">
> >
> >         <xsl:number level="multiple"
> >                 count="section"
> >                   format="1.1 " />
> >
> >           <xsl:value-of select="title"/>
> >          </fo:block>
> >
> >         <xsl:apply-templates select="para"/>
> >       </xsl:for-each>
> >
> > The following for the ToC page:
> >
> >  <xsl:for-each select="//section">
> >       <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 " />
> >
> >                 <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(//section)}"/>
> >               </fo:block>
> >             </fo:list-item-body>
> >           </fo:list-item>
> >         </fo:list-block>
> >       </xsl:for-each>
> >
> > Thanks
> >
> > K. S.
> >
> >   ------------------------------------------------------------------------
> >
> > Betreff: Re: table of contents
> > Datum: Fri, 16 Mar 2001 10:31:58 +0100
> > Von: Karin Sicheritz <karin.sicheritz@lemonplanet.com>
> > An: fop-dev@xml.apache.org
> > Referenzen: <3AB0AD62.291A8D4A@lemonplanet.com> <002001c0add2$4cdfd9d0$2a00a8c0@Jordan>
> >
> > 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" <karin.sicheritz@lemonplanet.com>
> > > To: <fop-dev@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
>
> ---------------------------------------------------------------------
> 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


Mime
View raw message