[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Re: XSL-List Digest V4 #1219


Subject: Re: [xsl] Re: XSL-List Digest V4 #1219
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 10 Apr 2003 18:19:02 +0100

> so I can refer to them in the table of contents.

If you know your  key="39" attributes give unique ids your life would be
a bit easier, but I'll assume not and ignore those and just use
generate-id instead.

The general pattern to generating a toc is in your default mode
you have some code that looks like

<xsl:template match="Bean_Suggestion">
 <fo:block id="generate-id()">
  .....


Now somewhere up the top you decide to generate a table of contents that
links to this so you go

<xsl:apply-templates mode="toc"/>

and in your toc mode you do something like
    
<xsl:template match="Bean_Suggestion" mode="toc">
 <fo:block id="generate-id()">
  ... <fo:basic-link internal-destination="{generate-id(.)}">


the important thingto note is that in order ro get the right link ID in
the table of contents you have to make use apply-templates (or for-each)
to get the current node to be where you want to refer to (ratherthan the
node representing the table of contents) that way generate-id() will
generate the same value at both ends of the link.

There's a complete worked example in the spec here:

http://www.w3.org/TR/xsl/slice6.html#section-N17805-Dynamic-Effects:-Link-and-Multi-Formatting-Objects

The N17805 there is a giveaway that the TOC in the XSL spec also used
generate-id() (and the xt XSLT processor I would guess) This is why
actually I try to avoid generate-id() in any medium where link ids are
exposed, It makes the link names change every time you edit the source.
This is less of an issue for FO than for pdf as you have no guarantee
that your id values will be used as the pdf link names anyway.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords