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

[xsl] RE: consolidating footnotes in XSL


Subject: [xsl] RE: consolidating footnotes in XSL
From: "Ann Marie Rubin \(anrubin\)" <anrubin@xxxxxxxxx>
Date: Sun, 17 Sep 2006 11:44:52 -0700

Hello XSL experts,

I have a follow-on question to this one.  This solution requires users
to add a value for the xref attribute for each footnote.

Another solution to consoldiating footnotes would be to create a
crossref XML element with an footnoteref attribute.  Footnotes would be
numbered automatically by the footnote template. To create a dup
footnote, the user would set the value of the opid attribute of the
footnote to reference, then insert a crossref element at the desired
location of the dup footnote, and set its target id attribute to the
opid value of the footnote to cross-reference.

The XSL code for the crossref element:

<xsl:template match="crossref">
	<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">
			<xsl:number count="//footnote[@opid=@targetid]"
format="1" level="any"/>
		</fo:inline>
	</xsl:otherwise>
	</xsl:choose>
</xsl:template>


The resulting output has no value for the footnote reference.

Can someone see what I might be doing wrong?

Thanks for your help.

Ann Marie


________________________________

From: Ann Marie Rubin (anrubin)
Sent: Sunday, September 17, 2006 10:20 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Cc: Ann Marie Rubin (anrubin)
Subject: consolidating footnotes in XSL


Hello XSL experts,

I am trying to NOT count duplicate footnotes. For example: I want
footnotes to number as follows:

foo1  foo2  foo2  foo3  foo4

1)foo text
2)foo 2 text
3)foo 4 text
4)foo text

I have XML with footnotes:

<footnote notetext="foo 3 text" xref="foo_fn1"/>
<footnote notetext="foo 3 text" xref="foo_fn2"/>
<footnote notetext="foo 3 text" xref="foo_fn2"/>
<footnote notetext="foo 3 text" xref="foo_fn3"/>
<footnote notetext="foo 3 text" xref="foo_fn4"/>

the XSL stylesheet:

<xsl:key match="footnote" name="FOOTNOTE" use="@xref"/>

...

<xsl:template match="footnote">
        <fo:footnote>
             <fo:inline font-size="0.83em" baseline-shift="super">
                  <xsl:number level="any"
count="footnote[generate-id()=generate-id(key('FOOTNOTE',@xref)[1])]"
format="1"/>
            </fo:inline>
            <fo:footnote-body>
                 <fo:list-block
provisional-distance-between-starts="20pt"
provisional-label-separation="5pt" start-indent="0.0in"
space-before="12pt">
                    <fo:list-item>
                        <fo:list-item-label end-indent="label-end()">
                            <fo:block
xsl:use-attribute-sets="standardFont" font-size="8pt">
                                 <xsl:number level="any"
count="footnote[generate-id()=generate-id(key('FOOTNOTE',@xref)[1])]"
format="1)"/>
                             </fo:block>
                       </fo:list-item-label>
                       <fo:list-item-body start-indent="body-start()">
                       <fo:block xsl:use-attribute-sets="standardFont"
font-size="8pt">
                           <xsl:value-of select="@notetext"/>
                       </fo:block>
                        </fo:list-item-body>
                    </fo:list-item>
                </fo:list-block>
            </fo:footnote-body>
        </fo:footnote>
    </xsl:template>

Output:

foo1  foo2  foo2  foo3  foo4

1)foo text
2)foo 2 text
2)foo 3 text
3)foo 4 text
4)foo text

What I want:

foo1  foo2  foo2  foo3  foo4

1)foo text
2)foo 2 text
3)foo 4 text
4)foo text

I want to NOT count footnote nodes whose refid matches the refid of the
previous footnote node.

How do I do tihs?

thanks,

Ann Marie


Current Thread
Keywords