Re: [xsl] generating <a href="#section"> menus. Related to <xsl:for-each> and generate-id()

Subject: Re: [xsl] generating <a href="#section"> menus. Related to <xsl:for-each> and generate-id()
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Tue, 14 Jan 2003 13:59:46 +0000
Hi Sherzod,

> To go further with my nonsense... I tried:
>
>  <xsl:template match="sect">
>    <a name="{generate-id()}"><xsl:value-of select="title" /></a>
>  </xsl:template>
>
> to book mark each section with unique name. And somewhere else, 
> I wanted to get the list of all the generated names(ids) and titles for
> the table of contents.

You just need to make sure that the IDs that you reference in the
table of contents are generated in the same way as the IDs that you
generate in the body of the document. So if you're creating anchors
with:

  <a name="{generate-id()">...</a>

then you need to create references to those anchors with:

  <a href="#{generate-id()}">...</a>

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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


Current Thread