[Home] [By Thread] [By Date] [Recent Entries]
Anne Marie,
Your diagnosis of the problem is correct, but in trying to solve it you are making it harder than it is. First, consider whatever code you are using to number your footnotes: <xsl:number count="footnote" format="1" level="any"/> I take it this works well enough. The reason this works is because it generates a number *for the context node* (this is important) in relation to its position in the tree. Now, when you process a different kind of element, the xrefinline, you want to generate a similar number, except you want the number generated not of the xrefinline itself, but of the footnote to which it points. This would be something like <xsl:for-each select="//footnote[@opid=$xrefnode]"> <!-- changing context to the footnote being pointed to --> <xsl:number count="footnote" format="1" level="any"/> <!-- generating its number --> </xsl:for-each> Note that for either performance or maintenance reasons, you may find it worthwhile either to: * bind //footnote to a global variable, as in <xsl:variable name="footnotes" select="//footnote"/> and then use it (for-each select="$footnotes[@opid=$xrefnode]) * or perhaps declare a key to grab footnotes using their @opid attributes (which will be even faster for the processor). But the basic solution is the same. Sometimes in complex stylesheets it's worthwhile creating an entire template mode for generating numbers this way: <xsl:template match="footnote" mode="number"> <xsl:number format="1" level="any"/> <!-- defaults to count="footnote" since we're matching a footnote --> </xsl:template> <xsl:template match="footnote"> ... <!-- generate your number for the footnote --> <xsl:apply-templates select="." mode="number"/> </xsl:template> <xsl:template match="xrefinline"> ... <!-- generate your number for the footnote being pointed to --> <xsl:apply-templates select="$footnotes[@opid=$xrefnode]" mode="number"/> </xsl:template> ... but it's still the same solution. This is nice since if there's other formatting required, such as the <fo:inline>, you can also put that in the template where the number is generated. Cheers, Wendell At 11:18 AM 9/20/2006, you wrote: Hello XSL experts,
|

Cart



