[xsl] REPOST - duplicate footnotes

Subject: [xsl] REPOST - duplicate footnotes
From: "Ann Marie Rubin \(anrubin\)" <anrubin@xxxxxxxxx>
Date: Wed, 20 Sep 2006 08:18:00 -0700
Hello XSL experts,

I'm reposting this question because I'm still thrashing trying to solve
this problem.

I have an XSL style sheet that counts all the footnotes in a document.
I'm trying to modify this stylesheet to not increment the count for
duplicate footnotes and to not output a footnote number with footnote
text for the duplicate note.

Desired output for this XML:

foo<footnote notetext="footnote text 1" opid="fn1"/>
bar<footnote notetext="footnote text 2" opid="fn2"/>
boo<xrefinline toFootnote="yes" targetid="opid="fn2"></xrefinline>

foo1
bar2
boo2

1. footnote text 1
2. footnot text 2

The xrefinline element has a targetid attribute set by a user to the
unique opid value of the footnote to reference. Here is the XSL template
for xrefinline.

When this template is matched, I have the opid number of the target
footnote.  I need to figure out how to output the number of the footnote
being referenced.  The code below always outputs 1, the number of
footnotes whose opid attribute equals the current targetid attribute.

Is there a way to do this?

<xsl:template match="xrefinline">
   <xsl:variable name="xrefnode" select="./@targetid" />

 		<xsl:choose>
			<xsl:when test="@toFootnote='no'">
        		<fo:basic-link color="blue"
internal-destination="{@targetid}">
           			<xsl:value-of select="."/>
(<xsl:value-of select="$__Page_Token"/>
            		<fo:page-number-citation
ref-id="{@targetid}"/>)</fo:basic-link>
 			</xsl:when>
		<xsl:otherwise>
				<fo:inline baseline-shift="super"
font-size="8pt">
				    <!--counts the number of footnotes
whose opid attribute = the targetid -->
					<!-- attribute of the current
note. I want to output the number of the  -->
					<!-- footnote referenced by this
targetid. -->
					<xsl:number
count="footnote[@opid=$xrefnode]" format="1" level="any"/>
				</fo:inline>
	    </xsl:otherwise>
		</xsl:choose>
   </xsl:template>

Current Thread