You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by gerhard oettl <ge...@oesoft.at> on 2005/12/11 10:54:48 UTC

fo:index

is there a workaround or xslt magic[1] or something else to get
the funcionality that was described as "formating objects for
indexing" in the working draft for xsl 1.1?

particularry the fo:index-page-citation-list was something that
would be very usefull for me.

[1] i think a lot of page-number-citation objects could do the
trick, but if i can avoid that i would prefere.

any hints or pointers?

are there any plans or a (aproximativ) timeframe when this
feature will make it into fop?


thanks in advance
gerhard

-- 
 .''`.   gerhard oettl   on   Debian/Gnu Linux
: :'  :  
`. `'`   gpg key: 1024D/D59131AA 2002-06-18
  `-

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: fo:index

Posted by gerhard oettl <ge...@oesoft.at>.
On Sun, Dec 11, 2005 at 05:35:36PM +0100, Andreas L Delmelle wrote:
>On Dec 11, 2005, at 13:17, gerhard oettl wrote:
>
>>On Sun, Dec 11, 2005 at 10:54:48AM +0100, gerhard oettl wrote:
>>>
>>>[1] i think a lot of page-number-citation objects could do the
>>>trick, but if i can avoid that i would prefere.
>>
>>I forgot to mention, that my main problem is not to get the
>>page-numbers but to supress duplicates.
>
>Ouch! Then it seems you're out of luck FTM, as there is absolutely no  
>way to determine at XSLT stage what the value of the page-number- 
>citation will be...

I was afraid that this will be the answer. Nevertheless thank you
for your example - maybe there are less duplicates than i expect.

gerhard

-- 
 .''`.   gerhard oettl   on   Debian/Gnu Linux
: :'  :  
`. `'`   gpg key: 1024D/D59131AA 2002-06-18
  `-

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: fo:index

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Dec 11, 2005, at 13:17, gerhard oettl wrote:

> On Sun, Dec 11, 2005 at 10:54:48AM +0100, gerhard oettl wrote:
>>
>> [1] i think a lot of page-number-citation objects could do the
>> trick, but if i can avoid that i would prefere.
>
> I forgot to mention, that my main problem is not to get the
> page-numbers but to supress duplicates.

Ouch! Then it seems you're out of luck FTM, as there is absolutely no  
way to determine at XSLT stage what the value of the page-number- 
citation will be...

Sorry.

Cheers,

Andreas



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: fo:index

Posted by gerhard oettl <ge...@oesoft.at>.
On Sun, Dec 11, 2005 at 10:54:48AM +0100, gerhard oettl wrote:
>
>[1] i think a lot of page-number-citation objects could do the
>trick, but if i can avoid that i would prefere.

I forgot to mention, that my main problem is not to get the
page-numbers but to supress duplicates. 

It is a surname index of a chronicle where some surnames are
used six to ten times on the same page. 

I need (currently) _no_ merging in the form:
Brown: 8,11-15,18,22
Smith: ...

I would be sadisfied with:
Brown: 8,11,12,13,14,15,18,22
Smith: ...

but i don't want a index with:
Brown: 8,11,12,12,12,12,12,12,12,12,12,12,12,13,14,15,18,22
Smith: ...



tanks
gerhard

-- 
 .''`.   gerhard oettl   on   Debian/Gnu Linux
: :'  :  
`. `'`   gpg key: 1024D/D59131AA 2002-06-18
  `-

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: fo:index

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Dec 11, 2005, at 10:54, gerhard oettl wrote:

Hi Gerhard,

> is there a workaround or xslt magic[1] or something else to get
> the funcionality that was described as "formating objects for
> indexing" in the working draft for xsl 1.1?
>
> particularry the fo:index-page-citation-list was something that
> would be very usefull for me.
>
> [1] i think a lot of page-number-citation objects could do the
> trick, but if i can avoid that i would prefere.

Currently that is the only way to go about it.

To mimic the example given in the XSL 1.1 WD (simplified):

Say you have <indexterm>term</indexterm> in a number of places in  
your source XML, then you can define a template like:

<xsl:template match="indexterm">
   <fo:wrapper id="concat(.,generate-id(.))" />
</xsl:template>

This will create the points the index will refer to.

I think you'll also need to define an xsl:key to group the indexterm  
nodes by their value (maybe not necessary for XSLT 2.0, since there  
you have the xsl:for-each-group functionality)

<xsl:key name="indexterm-by-term" match="indexterm" use="." />

Then, in your root template, as the very last step, you could create  
a new page-sequence and do something like:

<xsl:for-each select="//indexterm[generate-id()=
                        generate-id(key('indexterm-by-term',.)[1])]">
   <xsl:variable name="term" select="." />

   <fo:block>
     <xsl:value-of select="$term" />
     <xsl:text> </xsl:text>
     <xsl:for-each select="key('indexterm-by-term',$term)">
       <fo:basic-link internal-destination="concat(.,generate-id(.))">
         <fo:page-number-citation ref-id="concat(.,generate-id(.))" />
       </fo:basic-link>
       <xsl:if test="position()!=last()">
         <xsl:text>, </xsl:text>
       </xsl:if>
     </xsl:for-each>
   </fo:block>
</xsl:for-each>

Beware! Untested, so might need quite a bit of tweaking, but IIC,  
this is the general idea.

> are there any plans or a (aproximativ) timeframe when this
> feature will make it into fop?

None that I'm aware of, unfortunately.

HTH!

Cheers,

Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org