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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to