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() ) ]
) &lt; 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]

Reply via email to