Re: [xsl] back-referencing footnotes?

Subject: Re: [xsl] back-referencing footnotes?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 7 Jun 2005 00:32:58 +0100
> BTW, xt doesn't seem to like keys(), or I'm doing it wrong.

the original xt didn't implement keys although I remember a project
starting up a while back to complete xt's support for xslt, but most xt
users have long since switched to saxon or xalan, I would guess.

If you have keys then it's just
<xsl:key name="h" match="*[@HREF]" use="@HREF"/>
...
<xsl:template match="FN">
<p>
<xsl:apply-templates select="key('h',@ID)"/>
<xsl:text> </xsl:text>
<xsl:apply-templates/>
</p>
</xsl:template>

If you have a DTD that declares the HREF attribute to be of type ID then
you can instead do


<xsl:template match="FN">
<p>
<xsl:apply-templates select="id(@ID)"/>
<xsl:text> </xsl:text>
<xsl:apply-templates/>
</p>
</xsl:template>

alternatively of course you can always replace a key or id function by
its equivalent if slower xpath

<xsl:template match="FN">
<p>
<xsl:apply-templates select="//FNR[@HREF=current()/@ID]"/>
<xsl:text> </xsl:text>
<xsl:apply-templates/>
</p>
</xsl:template>

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. 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
________________________________________________________________________

Current Thread