Hi Pascal, I did not understand your answer to 3. How can I find two indexed words on the same page before fop inserted page breaks?
Hi Guiseppe, I use a two-pass approach. I keep a list of indexed words and their ref-ids. Then I generate the area tree for the document and look up the content of each ref-id block. Finding blocks with identical content I delete all but one. Then I generate the pdf again. This works quite nice, since I have the complete fo-file available (and the index page in memory) and since the index always starts on a new page. It would even work if the index was on the front of the publication, since the relative position between indexed words would not change (= No new pagebreaks will be inserted). But of course it's twice the work for the fop engine. Regards, Georg Datterl ------ Kontakt ------ Georg Datterl Geneon media solutions gmbh Gutenstetter Straße 8a 90449 Nürnberg HRB Nürnberg: 17193 Geschäftsführer: Yong-Harry Steiert Tel.: 0911/36 78 88 - 26 Fax: 0911/36 78 88 - 20 www.geneon.de Weitere Mitglieder der Willmy MediaGroup: IRS Integrated Realization Services GmbH: www.irs-nbg.de Willmy PrintMedia GmbH: www.willmy.de Willmy Consult & Content GmbH: www.willmycc.de -----Ursprüngliche Nachricht----- Von: Pascal Sancho [mailto:[email protected]] Gesendet: Freitag, 18. Juni 2010 09:51 An: [email protected] Betreff: Re: FOP, Index and duplicate Page number Hi Giuseppe, 1. no; 2. no, but any help is welcome to help in implementation of such feature; FOP is open source! 3 yes: using a 2 pass XSLT (no format here, but you can apply your own): <!-- XML snippet --> <para>my text with an <index>indexed word</index>.<para> <!-- XSLT snippet --> <!-- normal flow treatment (= 1st pass) --> <xsl:template match="index"> <fo:inline id="{generate-id(.)}"><xsl:apply-templates/></fo:inline> </xsl:template> <!-- collect all index entries for the entire doc (= 2nd pass) --> <xsl:template name="makeIndex"> <xsl:apply-templates mode="index" select="//index"> <xsl:sort select="."/> </xsl:apply-templates> </xsl:template> <xsl:template mode="makeIndex" match="index"> <xsl:if test="count( following::index[ string(.)=string( current() ) ] ) < 1"> <fo:block> <xsl:value-of select="."/> <xsl:text>: </xsl:text> <xsl:apply-templates mode="indexFirstPage" select="preceding::index[ string(.)=string( current() ) ]"/> <xsl:apply-templates mode="indexLastPage" select="."/> </fo:block> </xsl:if> </xsl:template> <xsl:template mode="indexFirstPage" match="index"> <fo:basic-link internal-destination="{generate-id(.)}"> <fo:page-number-citation ref-id="{generate-id(.)}"/> </fo:basic-link> <xsl:text>, </xsl:text> </xsl:template> <xsl:template mode="indexLastPage" match="index"> <fo:basic-link internal-destination="{generate-id(.)}"> <fo:page-number-citation ref-id="{generate-id(.)}"/> <xsl:text> </xsl:text> </fo:basic-link> </xsl:template> HTH, Pascal Le 18/06/2010 00:47, Giuseppe Briotti a écrit : > Hi all, I need to work on Index for very large document. > > The Index is formatted like this: > > Albert ................................... Pag. 4, 5 > Alfred ............................................6, 10, 11 > > It works fine, but sometimes there are several reference on the same > pages. The results it is not so good: > > Albert ................................... Pag. 4, 5, 5, 5 > Alfred ............................................6, 10, 10, 10, 11, 11 > > It seems from the FO specs that a best result like this: > > Albert ................................... Pag. 4, 5 > Alfred ............................................6, 10, 11 > > Can be achieved via a function equipped in XSL1.1. like > merge-*-index-key-reference. Unfortunately this function seems not to > be supported by FOP, as per > http://xmlgraphics.apache.org/fop/compliance.html. > > So, the questions are: > > 1. I'm missing something? > 2. there will be a scheduled evolution to achieve the support for such > feature? > 3. Someone here resolved the problem in a different way? > > TIA > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
